#_author:star
#date:2019/11/6
#logging 模块
import logging
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s %(filename)s [line:%(lineno)d] %(levelname)s %(message)s',
datefmt='%a,%d %b %y %H %M %S',
filename='test.log',)
#filemode='a')
logging.debug('debug message11')
logging.info('info message11')
logging.warning('warning message11')
logging.error('error message')
logging.critical('critical message11')
Output: