cel-python icon indicating copy to clipboard operation
cel-python copied to clipboard

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

Open falau opened this issue 2 years ago • 2 comments

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!

falau avatar Sep 04 '23 10:09 falau

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

kapilt avatar Sep 21 '23 19:09 kapilt

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.

ningsuhen-lyra avatar Aug 28 '24 22:08 ningsuhen-lyra