Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for stdlib's stacklevel parameter #537

Open
hynek opened this issue Aug 2, 2023 · 0 comments
Open

Add support for stdlib's stacklevel parameter #537

hynek opened this issue Aug 2, 2023 · 0 comments

Comments

@hynek
Copy link
Owner

hynek commented Aug 2, 2023

It's been added in Python 3.8:

The third optional keyword argument is stacklevel, which defaults to 1. If greater than 1, the corresponding number of stack frames are skipped when computing the line number and function name set in the LogRecord created for the logging event. This can be used in logging helpers so that the function name, filename and line number recorded are not the information for the helper function/method, but rather its caller. The name of this parameter mirrors the equivalent one in the warnings module.

C.f. https://docs.python.org/3.11/library/logging.html#logging.Logger.debug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant