Allow developers to control what is printed in their applications (and where) by only using a logger within module code.
Even after disabling loggers, I was getting DEBUG information printing to stdout. I tried a lot of things, and got pretty desperate...
loggers = [logging.getLogger(name) for name in logging.root.manager.loggerDict]
for logger in loggers:
try:
logger.removeHandler(sys.stderr)
except Exception:
pass
logger.setLevel(0)
logger.disabled = True
logger.propagate = False
Then I found print statements in the module.
This uses the existing logger instead of print. There are also some small fixes to technically incorrect Exception statements.
Allow developers to control what is printed in their applications (and where) by only using a logger within module code.
Even after disabling loggers, I was getting DEBUG information printing to stdout. I tried a lot of things, and got pretty desperate...
Then I found
print
statements in the module.This uses the existing logger instead of print. There are also some small fixes to technically incorrect Exception statements.