Python's logging allocates a name to every logger. That makes it hard to do something like, setting everything to logging.ERROR
. Here's one way you might go about that:
1 2 3 4 5 6 | for _name, logger in logging.Logger.manager.loggerDict:
try:
logger.setLevel(logging.ERROR)
# skip "PlaceHolder" loggers
except AttributeError:
pass
|
Derived from Michael Hrivnak's suggestion.
Tags: configuration, logging