import logging
logging.TRACE = 25
logging.addLevelName(logging.TRACE, "TRACE")
def __log_trace(self, message, *args, **kwargs):
if self.isEnabledFor(logging.TRACE):
self._log(logging.TRACE, message, args, **kwargs)
logging.basicConfig(
format='%(asctime)s %(filename)s [line:%(lineno)d] %(levelname)s: %(message)s',
datefmt='%Y-%m-%d %H:%M:%S',
level=logging.DEBUG
)
logging.Logger.trace = __log_trace
log = logging.getLogger('qqq')
log.setLevel(logging.DEBUG)
log.trace('asdf')
网友评论