You can control the log level so debug output can be hidden if it isn't wanted
You don't have to put a guard at the start of every log line to prepend it with the fact that it's a log message
You don't have to comment out logging messages that are too detailed; create them at a fine-detail logging level and once you're ready not to see them, increase the overall log level so they don't get printed.
I'd suggest that most things that are currently prints should be logging.info or logging.warns.
(If you need the timestamp on it, you can use logging.setFormatter to achieve this automatically.)
Python's build-in
logging
library gives some important advantages over usingprint
s everywhere.e.g.
I'd suggest that most things that are currently
print
s should belogging.info
orlogging.warn
s.(If you need the timestamp on it, you can use
logging.setFormatter
to achieve this automatically.)