Source code for mmf.async.logger
__all__ = ['logging', 'MyLogger', 'getLogger', 'DUMP', 'logLevel']
__nodoc__ = ['logging']
import logging
from logging import *
__all__.extend(logging.__all__)
DUMP = 5
logLevel = logging.INFO
logging.basicConfig(level=logLevel)
[docs]class MyLogger(logging.getLoggerClass()):
[docs] def dump(self, msg, *v, **kw):
self.log(DUMP, msg, *v, **kw)
[docs] def ddump(self, msg, data):
self.debug(msg)
self.dump(" "*len(msg) + repr(data))
logging.setLoggerClass(MyLogger)
[docs]def getLogger(name, logLevel=logLevel):
"""Return a logging object."""
logger = logging.getLogger(name)
logger.setLevel(logLevel)
return logger