Don't add more then one stderr handler
parent
b9a9b7a9a3
commit
d102b82566
|
@ -72,10 +72,10 @@ def get_console_log(level: str = None, name: str = None) -> logging.Logger:
|
|||
if level:
|
||||
log.setLevel(level.upper() if not isinstance(level, int) else level)
|
||||
|
||||
if not any(
|
||||
handler.stream == sys.stderr for handler in log.handlers
|
||||
if getattr(handler, 'stream', None)
|
||||
):
|
||||
for handler in log.handlers:
|
||||
if getattr(handler, 'stream', None) and handler.stream == sys.stderr:
|
||||
break
|
||||
else:
|
||||
handler = logging.StreamHandler()
|
||||
|
||||
formatter = colorlog.ColoredFormatter(
|
||||
|
|
Loading…
Reference in New Issue