[issue16778] Logger.findCaller needs to be smarter

Glynn Clements report at bugs.python.org
Tue Dec 25 17:20:28 CET 2012


New submission from Glynn Clements:

The current behaviour of logging.Logger.findCaller() makes it awkward to add custom logging interfaces.

E.g. suppose that you define a custom logging level (NOTICE) then add a notice() function (analogous to logging.info() etc), the resulting LogRecord structure will have pathname, filename, module, funcName and lineno members which refer to the notice() function itself, rather than to its caller.

This can be hacked around e.g. by using code.compile_command to lie about the source filename, but that's ugly and highly unintuitive.

----------
components: Library (Lib)
messages: 178145
nosy: glynnc
priority: normal
severity: normal
status: open
title: Logger.findCaller needs to be smarter
type: enhancement
versions: Python 2.7

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


More information about the Python-bugs-list mailing list