bugfix
This commit is contained in:
parent
41817c3b1a
commit
b745ead70a
@ -9,17 +9,16 @@ levels={
|
|||||||
"error":logging.error,
|
"error":logging.error,
|
||||||
"critical":logging.CRITICAL
|
"critical":logging.CRITICAL
|
||||||
}
|
}
|
||||||
defaultfmt = '%(asctime)s[%(name)s][%(filename)s:%(lineno)s]%(message)s'
|
defaultfmt = '%(asctime)s[%(name)s][%(levelname)s][%(filename)s:%(lineno)s]%(message)s'
|
||||||
logfile = -1
|
logfile = -1
|
||||||
level = None
|
level = levels.get('info')
|
||||||
|
|
||||||
def create_logger(name, formater=defaultfmt, levelname='info', file=None):
|
def create_logger(name, formater=defaultfmt, levelname='info', file=None):
|
||||||
global logfile, level
|
global logfile, level
|
||||||
if logfile == -1:
|
if logfile == -1:
|
||||||
logfile = file
|
logfile = file
|
||||||
ret = logging.getLogger(name)
|
ret = logging.getLogger(name)
|
||||||
if level is None:
|
level = levels.get(levelname, levels.get('info'))
|
||||||
level = levels.get(levelname, levels.get('debug'))
|
|
||||||
ret.setLevel(level)
|
ret.setLevel(level)
|
||||||
format = logging.Formatter(formater)
|
format = logging.Formatter(formater)
|
||||||
file_handler = None
|
file_handler = None
|
||||||
|
Loading…
Reference in New Issue
Block a user