..note:: Do not change or use the underlying logger or functionality here
(in particular, get_level) is no longer reliable!
+
+ ..warn:: Propagation to root logger has to be disabled in these loggers
+ since otherwise any other use of python's :py:mod:`logging`
+ module leads to re-initialization of the root logger with handler
+ to stderr and thus duplicate logging output
"""
def __init__(self, name, level=INFO, fmt=DEFAULT_SHORT_LEVEL_FORMAT,
.format(name))
self._log = logging.getLogger(name)
+ if '.' not in name:
+ # root logger may be re-initialized from other imported modules,
+ # so propagation to it will lead to duplicate output
+ self._log.propagate = False
if isinstance(level, str):
level = LEVEL_DICT[level]
self._level = min(MAX_LEVEL, max(MIN_LEVEL, level))