[issue16778] Logger.findCaller needs to be smarter

Michael Rohan report at bugs.python.org
Mon Jul 21 01:49:49 CEST 2014


Michael Rohan added the comment:

I recently implemented a custom logger derived from Logger and to get the
reporting of modules, etc, correct, I implemented the findCaller using
the same code as library code with the minor change of

if filename == _srcfile:

to

if filename in [logging._srcfile, _mysrcfile]:

with the local _mysrcfile being determined the same as in logging.

Maybe simply having a class list "srcfiles = [_srcfile]" and allowing
people who customize extend this would be the easiest way of handling
this: "Logger.srcfiles.append(_mysrcfile)"

----------
nosy: +mrohan

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16778>
_______________________________________


More information about the Python-bugs-list mailing list