Type igore `colorlog`
parent
11cbf9ea55
commit
18c55e2b5f
|
@ -4,7 +4,7 @@ Log like a forester!
|
|||
from functools import partial
|
||||
import sys
|
||||
import logging
|
||||
import colorlog
|
||||
import colorlog # type: ignore
|
||||
|
||||
_proj_name = 'tractor'
|
||||
_default_loglevel = None
|
||||
|
@ -69,16 +69,10 @@ def get_console_log(level: str = None, name: str = None) -> logging.Logger:
|
|||
log = get_logger(name) # our root logger
|
||||
|
||||
if not level:
|
||||
return
|
||||
return log
|
||||
|
||||
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)
|
||||
):
|
||||
handler = logging.StreamHandler()
|
||||
|
||||
formatter = colorlog.ColoredFormatter(
|
||||
LOG_FORMAT,
|
||||
datefmt=DATE_FORMAT,
|
||||
|
|
Loading…
Reference in New Issue