Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Add support for stdlib's stacklevel parameter

Open
#537 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
backend

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

enhancement

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from hynek/structlog

All issues in hynek/structlog

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.