Logging - mwicat/personal GitHub Wiki

https://docs.python.org/2/howto/logging.html#optimization

if logger.isEnabledFor(logging.DEBUG):
    logger.debug('Message with %s, %s', expensive_func1(),
                                        expensive_func2())

Get handler

l = logging.getLogger('')
h = l.handlers[0]