-
Notifications
You must be signed in to change notification settings - Fork 82
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
Use logging instead of print() #214
Comments
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.
(you might want to have a check for acceptable values before: Step 2: if you want to do something more complicated/precise, have a look at 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. |
So where this stands now is that we need to add a switch for the different logging levels and assign priorities to each message in the code. |
I'm going to mark this as done and create a separate issue for creating filters etc. |
Other feature request
Is your feature request related to a problem? Please describe.
It seems to not be best practice to use print(). A better option is to use logging. This will also allow us to improve debugging if needs be, as well as providing scope for higher priority warnings etc.
Describe the solution you'd like
Let's implement logging instead of our print calls.
Describe alternatives you've considered
We could keep the print as-is, but it's annoying to work around and it would be nice to have the debugging features logging provides.
Additional context
Some references about logging:
The text was updated successfully, but these errors were encountered: