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

Logging levels & configuration #231

Open
nocalla opened this issue Oct 15, 2018 · 2 comments
Open

Logging levels & configuration #231

nocalla opened this issue Oct 15, 2018 · 2 comments
Assignees
Projects

Comments

@nocalla
Copy link
Member

nocalla commented Oct 15, 2018

Dear submitter, please edit the following according to your needs. Thank you!

Other feature request

Is your feature request related to a problem? Please describe.
At the moment, when running the automated tests, all of the messages spam the test console.

Describe the solution you'd like
Implement logging levels and a switch to disable the not-required ones when testing.
This will also have the benefit of allowing us to add additional debug lines for hunting errors if we need them.

Describe alternatives you've considered
Otherwise we could just remove all of the output messages!

Additional context
Some references about logging:

@toyg's take on this issue from #214:
Step 1: the logging level must be set in a config file, not in source. The simplest way to achieve this is to have a config parameter that can store a value (e.g. LogLevel = INFO), then in code something like:basicConfig(... , level=getattr(logging,your_param)) (you might want to have a check for acceptable values before: if your_param not in ['INFO','DEBUG'...]: your_param='INFO')Step 2: if you want to do something more complicated/precise, have a look at dictConfig().Step 3: you can have a simple environment variable (say DEBUG=1) and depending on that value, switch between basicConfig and dictConfig, so you can e.g. pass a complicated config for debug/testing purposes, and a simple one for production default. Or just keep all the logging machinery in a separate config file (like a JSON) and use dictConfig all the time, providing different files when required.I'm not a test guru, I'm sure there are many other ways to skin this particular cat, but the ideas above are the simplest strategies and rely on simple stdlib modules.

@nocalla nocalla self-assigned this Oct 15, 2018
@nocalla nocalla added this to Candidates in 1.2.0 via automation Oct 15, 2018
@duch11
Copy link
Contributor

duch11 commented Mar 26, 2019

I have recently worked a lot with the python logging feature, I guess I could take a quick look at it, at some time.

@nocalla
Copy link
Member Author

nocalla commented Jan 7, 2020

@clancychilds has pushed a solution to this over here #311.

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

Successfully merging a pull request may close this issue.

2 participants