标签:time error TE formatter evel ESS asc span orm
import logging
def my_log():
logger = logging.getLogger(‘mysql.log‘)
# 每次被调用后打印出logger的handlers列表
print(logger.handlers)
ch = logging.StreamHandler()
ch.setLevel(logging.ERROR)
fmt = logging.Formatter(‘%(asctime)s - %(name)s - %(levelname)s - %(message)s‘)
ch.setFormatter(fmt)
logger.addHandler(ch)
return logger
my_log().error(‘run one‘)
my_log().error(‘run two‘)
my_log().error(‘run three‘)
标签:time error TE formatter evel ESS asc span orm
原文地址:https://www.cnblogs.com/huang-yc/p/9209418.html