vendorize lazy colored logger from kython
This commit is contained in:
parent
604cd40699
commit
a1f65754f9
3 changed files with 94 additions and 29 deletions
15
my/common.py
15
my/common.py
|
@ -79,20 +79,7 @@ def listify(fn=None, wrapper=list):
|
|||
# return listify(fn=fn, wrapper=md)
|
||||
|
||||
|
||||
# TODO try importing logzero defensively?
|
||||
def setup_logger(logger, level=None, format=None, datefmt=None):
|
||||
import logging
|
||||
old_root = logging.root
|
||||
try:
|
||||
logging.root = logger
|
||||
logging.basicConfig(
|
||||
level=level or logging.DEBUG,
|
||||
format=format or '%(name)s %(asctime)s %(levelname)-8s %(filename)s:%(lineno)-4d %(message)s',
|
||||
datefmt=datefmt or '%Y-%m-%d %H:%M:%S',
|
||||
)
|
||||
finally:
|
||||
logging.root = old_root
|
||||
|
||||
from .kython.klogging import setup_logger, LazyLogger
|
||||
|
||||
PathIsh = Union[Path, str]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue