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.
Python 3.8 adds a
stacklevelargument to the methods of theLoggerclass. 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
Logger.{debug, info, warning, exception, …}in our code base and check if we can use the new parameter to our/the users advantagecaplogfixture, to assert that the log entry is issued at the stacklevel that we expect it toA PR in this direction is very welcome. As long as #3728 is open, it should be based on the
drop-py-37branch. A PR can probably take a lot of inspiration from #3674 which did similar things for thewarnings. 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.