Skip to content

MNT: Prefer capitalized logging levels #30339

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

timhoffm
Copy link
Member

#30302 just introduced literals for the log levels. Previously, the situation was a bit vague: While the docstring described the levels as all lowercase, in fact any casing is accepted. This PR changes the preferred casing to be all-capitalized in analogy to the logging standard library, which only supports this casing. Lowercase remains supported because it's not worth an API breakage.

We might later consider to also accept logging levels directly, i.e. logging.DEBUG to be more congruent with the logging library. But this can be done any time. It's important to get this PR in soon to not release the typing Literal in lowercase form.

matplotlib#30302 just introduced literals for the log levels. Previously, the
situation was a bit vague: While the docstring described the levels
as all lowercase, in fact any casing is accepted. This PR changes the
preferred casing to be all-capitalized in analogy to the logging
standard library, which only supports this casing. Lowercase remains
supported because it's not worth an API breakage.

We might later consider to also accept logging levels directly, i.e.
`logging.DEBUG` to be more congruent with the logging library. But this
can be done any time. It's important to get this PR in soon to not
release the typing Literal in lowercase form.
@github-actions github-actions bot added Documentation: devdocs files in doc/devel Documentation: user guide files in galleries/users_explain or doc/users labels Jul 21, 2025
@QuLogic QuLogic added this to the v3.11.0 milestone Jul 21, 2025
Co-authored-by: Thomas A Caswell <tcaswell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation: devdocs files in doc/devel Documentation: user guide files in galleries/users_explain or doc/users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants