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

Require valid module path in getLogger() #14

Open
adamchainz opened this issue Aug 24, 2023 · 0 comments
Open

Require valid module path in getLogger() #14

adamchainz opened this issue Aug 24, 2023 · 0 comments

Comments

@adamchainz
Copy link
Owner

adamchainz commented Aug 24, 2023

Description

Sometimes explicit calls to getLogger() don't use a dotted module path, but some other characters that aren't valid in module names like hyphens:

import logging
logger = logging.getLogger("acme-api")

Although the getLogger() docs say:

Choice of these names is entirely up to the developer who is using logging.

Typically apps aim for dotted module paths, per the __name__ pattern. Deviations from this can cause issues, such as not propagating through the intended chain of loggers, such as through an acme root in the example.

Let's detect strings passed to getLogger that aren't valid module paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant