You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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!
@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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: