ssato / python-anyconfig

Python library provides common APIs to load and dump configuration files in various formats
MIT License
279 stars 31 forks source link

Suppress warnings/output when using API only. #27

Closed rholmboe closed 9 years ago

rholmboe commented 9 years ago

When importing anyconfig into existing project, there is no setting to be set to use existing project log level. Primary I would love seeing a logger inheritance or some sort of suppressor.

ssato commented 9 years ago

Most of modules in anyconfig should use a logger inherited from logging.getLogger("anyconfig"), if not that is a bug and please let me know about it.

Prior to the commit 87f013f, some warning messages will be shown in the default log level (loggging.INFO) but it's possible to suppres it by setting the log level of the logger of anyconfig, e.g. logging.getLogger("anyconfig").setLevel(logging.ERROR), I think.

Also in the commit e20c61e, I added the section about logging. Please take a look at it and let me know if I have something forgeten or missing:

https://github.com/ssato/python-anyconfig/blob/master/docs/usage.rst#suppress-logging-messages-from-anyconfig-module

ssato commented 9 years ago

Is this still an issue? If so, could you please let me know how the issue is happen? Then I'll make a few test cases to re-produce it and fix the problem.

rholmboe commented 9 years ago

Hi,

Sorry for the late update.I got it working now with our skeleton cli tool. This got it working for me as well as per your documentation.

logging.getLogger("anyconfig").setLevel(logging.DEBUG)
import anyconfig

Thank you for your assistance.

KR Richard