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

Convert all prints to use loggers and appropriate log levels. #41

Closed
dwf opened this issue Feb 29, 2012 · 3 comments
Closed

Convert all prints to use loggers and appropriate log levels. #41

dwf opened this issue Feb 29, 2012 · 3 comments

Comments

@dwf
Copy link
Contributor

dwf commented Feb 29, 2012

Specifically, stick something like

import logging
...
...

logger = logging.getLogger("put.module.name.here")

at the t op of the module.

Very verbose output with print statements should then be replaced with logger.debug(); less verbose but useful stuff with logger.info(); stuff that goes wrong that the user should know about even if they don't care about info() level stuff should be a logger.warning(), etc.

This will allow us to easily and programmatically redirect logging output, change logging verbosity, apply common styling to all log messages (add timestamps, blah).

See the Logging Cookbook and the logging module docs.

@memimo
Copy link
Member

memimo commented Mar 4, 2014

@dwf Wouldn't logging.getLogger(__name__) be better option than manually putting the module name?

@memimo
Copy link
Member

memimo commented Mar 11, 2014

Should we replace test files print statement as well?

@memimo
Copy link
Member

memimo commented Mar 13, 2014

Should we add a unit test to check for new PRs if they have exists print statement in the code? Although this would enforce it to test scripts as well.

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

No branches or pull requests

2 participants