You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In python3.8 the logging.Logger.log (and .info(), .debug(), etc...) gained a new stacklevel argument.
The stacklevel parameter is passed from code calling the debug() and other APIs. If greater than 1, the excess is used to skip stack frames before determining the values to be returned. This will generally be useful when calling logging APIs from helper/wrapper code, so that the information in the event log refers not to the helper/wrapper code, but to the code that calls it. https://docs.python.org/3/library/logging.html#logging.Logger.findCaller
Currently coloredlogs does not respect the stacklevel argument as can be seen in this example; lib.py
In python3.8 the
logging.Logger.log
(and.info()
,.debug()
, etc...) gained a newstacklevel
argument.Currently
coloredlogs
does not respect thestacklevel
argument as can be seen in this example;lib.py
and
app.py
running this with
coloredlogs
yields$ python app.py 2021-03-09 11:33:37 dev lib[92930] INFO hello!
commenting out the
coloredlogs.install(logging.INFO)
, and un-commenting thelogging.basicConfig(...)
yieldspython app.py 2021-03-09 11:35:33 INFO app.py:16 hello!
The text was updated successfully, but these errors were encountered: