Add the logging.py findCaller() stacklevel as a debugger attribute
because when extending the default Logger and implementing/specializing the `_log` function, all stacktraces need to be increased by 1. For example, the debug_tools pypi module inherits from Logger and defines its own _log() function:d279bf3278/all/debug_tools/logger.py (L166)
d279bf3278/all/debug_tools/logger.py (L970)
d279bf3278/all/debug_tools/logger.py (L1317)
This commit is contained in:
parent
0a87186030
commit
51ef33f2e9
|
@ -1403,6 +1403,7 @@ class Logger(Filterer):
|
||||||
self.handlers = []
|
self.handlers = []
|
||||||
self.disabled = False
|
self.disabled = False
|
||||||
self._cache = {}
|
self._cache = {}
|
||||||
|
self.default_stack_level = 2
|
||||||
|
|
||||||
def setLevel(self, level):
|
def setLevel(self, level):
|
||||||
"""
|
"""
|
||||||
|
@ -1506,7 +1507,7 @@ class Logger(Filterer):
|
||||||
Find the stack frame of the caller so that we can note the source
|
Find the stack frame of the caller so that we can note the source
|
||||||
file name, line number and function name.
|
file name, line number and function name.
|
||||||
"""
|
"""
|
||||||
f = currentframe(2 + stacklevel)
|
f = currentframe(self.default_stack_level + stacklevel)
|
||||||
#On some versions of IronPython, currentframe() returns None if
|
#On some versions of IronPython, currentframe() returns None if
|
||||||
#IronPython isn't run with -X:Frames.
|
#IronPython isn't run with -X:Frames.
|
||||||
if f is not None:
|
if f is not None:
|
||||||
|
|
Loading…
Reference in New Issue