Add support for stdlib's stacklevel parameter
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 35/100
Research direction
Start by reading the logging call paths in structlog and the stdlib Logger.debug documentation linked in the issue. Check how logging helpers pass keyword arguments to the standard library, then identify the relevant tests. Done means callers can use stacklevel and the resulting LogRecord reports the caller’s filename, function name, and line number.
Written by the indexing model from the issue text.
Description
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
- Dominant language
- Python
- Stars
- 5k
- Forks
- 302
- Avg merge
- 17m
- Merged PRs (30d)
- 4
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from hynek/structlog
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Transform examples in docs into included source filesPossibly taken @alexchen-sys claimed this 97 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 25/100
-
Difficulty 5/5 Over a week Newbie friendliness 38/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
waiting for feedback
Difficulty 3/5 1-2 days Newbie friendliness 48/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
developmentseed/titiler-cmr#250 · 1 comment ·
Maintainers usually reply within 1 day
-
[Bug]: IndexHandler.post crashes with HTTP 500 on malformed payloads, missing credentials, or when login is disabledPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 6 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
cookiecutter/cookiecutter-django#6999 ·
Maintainers usually reply within 1 day
-
fix: @_helpers.positional raises TypeError when decorating functions without default argumentsPossibly taken @codeXsidd claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 88/100
googleapis/google-api-python-client#2845 ·
Maintainers usually reply within 1 day
-
github_actions
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
collective/icalendar#2003 · 1 comment ·
Maintainers usually reply within 1 day