
import logging
logging.basicConfig(level=logging.WARNING,
filename='./log.txt',
filemode='w',
format='%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s')
# use logging
logging.info('python写日志文件 info message')
logging.debug('python写日志文件 debug message')
logging.warning('python写日志文件 warning message')
logging.error('python写日志文件 error message')
logging.critical('python写日志文件 critical message')




高级设计师
by: Python自学 发表于:2022-10-24 22:43:00 顶(0) | 踩(0) 回复
回复评论