logging配置

 1 import logging
 2 logging.basicConfig(level=logging.WARNING,
 3                     format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s',
 4                     datefmt='%a, %d %b %Y %H:%M:%S')
 5 try:
 6     int(input('num >>'))
 7 except ValueError:
 8     logging.error('输入的值不是一个数字')
 9 
10 logging.debug('debug message')       # 低级别的 # 排错信息
11 logging.info('info message')            # 正常信息
12 logging.warning('warning message')      # 警告信息
13 logging.error('error message')          # 错误信息
14 logging.critical('critical message') # 高级别的 # 严重错误信息
basicConfig

相关文章:

  • 2021-04-11
  • 2022-02-03
  • 2021-12-04
  • 2022-02-23
  • 2022-02-21
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-03-06
  • 2022-12-23
  • 2022-03-03
  • 2022-02-08
  • 2021-09-18
  • 2021-10-19
  • 2021-11-24
相关资源
相似解决方案