-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
[Proposal] Revise the logger instanciation/initial handlers #134
Comments
Hi, I am open to that. Provided that the argument To resume the proposal and add a bit of constraint.
Was not dismissed, I focused the work on other matters at hand. |
Thanks! I'll draft a PR over the next couple of days that meets these conditions. |
Is your feature request related to a problem? Please describe.
The Logger is initialized in charset/api.py in a way that does not allow developers using the library to change the logging level via the root logger. The Python Logging library now makes a NullHandler available to allow library and package developers to manage logging in a way that is flexible for application developers. The (Python 3 documentation)[https://docs.python.org/3/howto/logging.html#configuring-logging-for-a-library] has this snippet:
Describe the solution you'd like
I would like to change api.py to set up a NullHandler logger and add a function to allow application developers to set the StreamHandler. The function would be added to the init.py file for charset_normalizer. The existing format would be provided as the default for the StreamHandler. The boto3 library has a nice example of this. Including the function below.
Additional context
I am happy to write the PR for this. Just wanted to make sure the developers have not considered this and dismissed the change for a reason unbeknownst to me. Also, please let me know if this is not a good fit for the library. I won't be offended! I promise :)
The text was updated successfully, but these errors were encountered: