def _log(self, level, msg, args,
exc_info=None, extra=None, stack_info=False, attachment=None):
"""
Low-level logging routine which creates a LogRecord and then calls
all the handlers of this logger to handle the record.
"""
sinfo = None
if logging._srcfile:
# IronPython doesn't track Python frames, so findCaller raises an
# exception on some versions of IronPython. We trap it here so that
# IronPython can use logging.
try:
fn, lno, func, sinfo = self.findCaller(stack_info)
except ValueError: # pragma: no cover
fn, lno, func = '(unknown file)', 0, '(unknown function)'
else:
fn, lno, func = '(unknown file)', 0, '(unknown function)'
if exc_info and not isinstance(exc_info, tuple):
exc_info = sys.exc_info()
record = self.makeRecord(
self.name, level, fn, lno, msg, args, exc_info, func, extra, sinfo
)
record.attachment = attachment
self.handle(record)
评论列表
文章目录