(continued from previous page) about to log at WARNING ... about to log at ERROR ... about to log at CRITICAL ... Calling decorated foo with False about to log at DEBUG ... about to log at INFO ... about to log at WARNING ... Calling decorated foo with True about to log at DEBUG ... about to log at INFO ... about to log at WARNING ... about to log at ERROR ... Actually logged at DEBUG Actually logged at INFO Actually logged at WARNING Actually logged at ERROR about to log at CRITICAL ... Actually logged at CRITICAL import logging import logging.config import time classUTCFormatter (logging .Formatter): converter=time.gmtime LOGGING ={ 'version':1, 'disable_existing_loggers ': False , 'formatters': { 'utc': { '() ': UTCFormatter, 'format':' %(asctime)s %(message)s ', }, 'local ': { (continues on next page) 38 and you can then use the$_{UTCFormatter}$ in your code instead of$_{Formatter}$. If you want to do that via config- uration, you can use the$_{dictConfig()}$ API with an approach illustrated by the following complete example: import logging import time classUTCFormatter (logging .Formatter): converter=time.gmtime Sometimes you want to format times using UTC, which can be done using a class such as UTCFormatter , shown below: 26 Formatting times using UTC (GMT) via configuration As you can see, actual logging output only occurs when an event is logged whose severity is ERROR or greater, but in that case, any previous events at lower severities are also logged. You can of course use the conventional means of decoration: @log_if_errors (logger) def foo(fail = False ): ...