Skip to content

Adopt Py3.8+ features: Logging Stacklevel #3729

@Bibo-Joshi

Description

@Bibo-Joshi

Python 3.8 adds a stacklevel argument to the methods of the Logger class. This allows to be more precise about where the resulting log line should point to in order to be helpful for the user.
We should

  • review all usages of Logger.{debug, info, warning, exception, …} in our code base and check if we can use the new parameter to our/the users advantage
  • improve the test suite, i.e. every test that uses the caplog fixture, to assert that the log entry is issued at the stacklevel that we expect it to

A PR in this direction is very welcome. As long as #3728 is open, it should be based on the drop-py-37 branch. A PR can probably take a lot of inspiration from #3674 which did similar things for the warnings. If you would like to send a PR, please be sure to read our contribution guide and leave a short comment so that we can assign you.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions