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

Default logging configuration is too noisy, proper way to disable logging in this lib? #46

Open
falau opened this issue Sep 4, 2023 · 2 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@falau
Copy link

falau commented Sep 4, 2023

The default configuration(logger names/logging levels in each module) doesn't seem to be reasonable when using this package as a library. A simple logging.basicConfig(level=logging.INFO) could easily flood the logging output.

I know I can make it less noisy by setting the loggers used in the module individually like logging.getLogger(logger_name).setLevel(some_other_level), but the logger names in this module are not really consistent such as prefixing with a single module name or so, I can only go to the source code to find out all the logger names used rather than adding a prefix filter to disable all loggers in one go:

for _logger_name in ("Evaluator", "evaluation", "NameContainer", "celtypes", "Environment"):
  logging.getLogger(_logger_name).setLevel(logging.WARNING)

This approach doesn't really look sustainable, especially, I can't know if there will be any change, such as new loggers added; old loggers removed, etc., in this module.

Therefore, I'm wondering if it's possible to support one of the followings going forward?

  • Consolidate the logger names into something predictable
  • Add an option to adjust all the loggers used
  • Allow users to pass in loggers
  • others idk

Thank you!

@kapilt
Copy link
Collaborator

kapilt commented Sep 21, 2023

thanks for the bug report, yeah it does seem reasonable to prefix all the loggers here, to make it more ergonomic to switch the level

@ningsuhen-lyra
Copy link

Hi, it would also be nicer to fix the default logging. I'm coming from https://github.com/bufbuild/protovalidate and can see logs 1000s of logs on validating a single proto message. I think these should be debug logs and not info logs. Not sure if this can be done in protovalidate in which case, I can raise a request there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants