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
Rather than rely on a verbose flag to dictate whether we should print output to stdout, it would be better to rely on standard logging tools and severity warning levels to control what is directed where. It would also offer greater granularity over alerts: INFO, DEBUG, WARNING, ERROR and CRITICAL. When troubleshooting a user could enable INFO level,but in prod just WARNING (and above).
At runtime, a user can opt-in to seeing these log traces:
logging.basicConfig(level=logging.DEBUG)
logging.debug('this will be displayed')
logging.info('this will not because INFO is below DEBUG')
The task of this ticker is therefore to find all places in the code that uses print to report application state to the user/process and replace it with logging. This would leave the verbose redundant and allow for its removal, simplifying the API - delete their use. This may break some implementation tests (see #155), in which case consider their removal if they are testing function call arguments (but not if they are testing behaviour of the code).
The text was updated successfully, but these errors were encountered:
What
Rather than rely on a
verbose
flag to dictate whether we should print output to stdout, it would be better to rely on standard logging tools and severity warning levels to control what is directed where. It would also offer greater granularity over alerts: INFO, DEBUG, WARNING, ERROR and CRITICAL. When troubleshooting a user could enable INFO level,but in prod just WARNING (and above).Why
From the core Python docs, the advice is:
If you want to:
Use
print(msg)
.But if you want to
Use
logging.info()
orlogging.debug()
. There's an analogous statement for warnings andlogging.warning()
.How
Here is an example:
Which I would suggest replacing with:
At runtime, a user can opt-in to seeing these log traces:
The task of this ticker is therefore to find all places in the code that uses print to report application state to the user/process and replace it with logging. This would leave the
verbose
redundant and allow for its removal, simplifying the API - delete their use. This may break some implementation tests (see #155), in which case consider their removal if they are testing function call arguments (but not if they are testing behaviour of the code).The text was updated successfully, but these errors were encountered: