PyMOTW: logging

The logging module defines a standard API for reporting errors and
status information from all of your modules. The key benefit of having
the logging API provided by a standard library module is that all python
modules can participate in logging, so your application log can include
messages from third-party modules.

Read more at logging