Use user's polar dir
This commit is contained in:
parent
9a3c290dbe
commit
a0b9d2dc05
4 changed files with 26 additions and 7 deletions
14
my/common.py
14
my/common.py
|
@ -76,3 +76,17 @@ def listify(fn=None, wrapper=list):
|
|||
# def md(it):
|
||||
# return make_dict(it, key=key, value=value)
|
||||
# return listify(fn=fn, wrapper=md)
|
||||
|
||||
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue