def set_logging(lvl='info'):
global logger
try:
if not (isinstance(lvl, int) and lvl in LOG_LEVELS.values()):
lvl = LOG_LEVELS[lvl]
except KeyError:
return False
logging.basicConfig(format=LOG_FORMAT, level=lvl)
if coloredlogs is not None:
coloredlogs.install(lvl, fmt=LOG_FORMAT)
if logger is not None:
logger.setLevel(lvl)
return True
评论列表
文章目录