Pythong logging 模块简单使用方法
示例如下:
----------------------------------------------------------------
import logging
logging.basicConfig(
filename="config.log",
format='%(asctime)s [%(levelname)-7s] %(message)s',
level=logging.DEBUG,
filemode='w')
logging.debug('A debug message')
logging.info('Some information')
logging.warning('A shot across the bows')
输出结构如下:
----------------------------------------------------------------
2010-11-22 23:18:08,046 [DEBUG ] A debug message
2010-11-22 23:18:08,046 [INFO ] Some information
2010-11-22 23:18:08,046 [WARNING] A shot across the bows
Python logging
最新推荐文章于 2025-05-18 14:54:27 发布
1222

被折叠的 条评论
为什么被折叠?



