Skip to content
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

[LOG015] should suggest the use of logging.getLogger(__name__) #14390

Closed
MichaReiser opened this issue Nov 16, 2024 · 2 comments · Fixed by #14392
Closed

[LOG015] should suggest the use of logging.getLogger(__name__) #14390

MichaReiser opened this issue Nov 16, 2024 · 2 comments · Fixed by #14392
Labels
bug Something isn't working preview Related to preview mode features rule Implementing or modifying a lint rule

Comments

@MichaReiser
Copy link
Member

MichaReiser commented Nov 16, 2024

The recently implemented LOG015 in #14302 is in conflict with LOG002. One suggests using logging.getLogger(__file__), the other calls that a bad practice. LOG015 should suggest logging.getLogger(__name__).

It also seems to be triggering when logging.getLogger(__name__) is already being used, ie, not a root logger.

Originally posted by @qartik in #7248 (comment)

LOG015 incorrectly suggests the usage of logging.getLogger(__file__) over ``logging.getLogger(name)`.

@MichaReiser MichaReiser added bug Something isn't working rule Implementing or modifying a lint rule preview Related to preview mode features labels Nov 16, 2024
@MichaReiser
Copy link
Member Author

@InSyncWithFoo are you interested in taking a look at the fix?

@InSyncWithFoo
Copy link
Contributor

Submitted a PR. An easy fix, as only the doc comment is affected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working preview Related to preview mode features rule Implementing or modifying a lint rule
Projects
None yet
2 participants