Post

0204logging

  • basicConfig配置日志打印(p82)
1
2
3
import logging
logging.basicConfig(level=logging.INFO,                               #设置日志级别为 INFO
                    format='%(asctime)s - %(levelname)s: %(message)s')#设置打印格式: 时间 - 级别:日志消息
  • 日志打印 Traceback 错误堆赞信息(p83)
1
loggin.error("error!!",exc_info=True)#exc_info=True日志打印 Traceback 错误堆赞信息
This post is licensed under CC BY 4.0 by the author.