我常用的调试设置,一般当print使用
import logging
logging.basicConfig(level=logging.DEBUG,
format="%(asctime)s %(name)s %(levelname)s : %(message)s",
datefmt = '%Y-%m-%d %H:%M:%S %a'
)
logging.debug('write what you whant see')
logging.info('写点自己想说的')
#测试
logging.debug('hello')
#2021-10-15 11:23:38 Fri root DEBUG : hello
logging.info('hello')
#2021-10-15 11:24:02 Fri root INFO : hello
logging.warning('hello')
#2021-10-15 11:24:38 Fri root WARNING : hello
logging.error('hello')
#2021-10-15 11:24:46 Fri root ERROR : hello
相关设置的原因及原理请查看其他博客.



