Python logging 模块简单实用
来源:互联网 发布:淘宝上买圣衣神话 编辑:程序博客网 时间:2024/06/11 13:09
import logging
logging.basicConfig(level=logging.DEBUG,
format=’%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s’,
datefmt=’%a, %d %b %Y %H:%M:%S’,
filename=’debuglog.log’,
filemode=’a+’)#定义格式
console = logging.StreamHandler()
console.setLevel(logging.INFO)#定义记录水平
formatter = logging.Formatter(‘%(name)-12s: %(levelname)-8s %(message)s’)
console.setFormatter(formatter)
logging.getLogger(”).addHandler(console)
logging.debug(‘this is debug’) #不被记录 -这个是由console.setLevel(logging.INFO)决定
logging.info(‘this is info’) #不被记录 -这个是由console.setLevel(logging.INFO)决定
logging.warning(‘this is warn’) #被记录-这个是由console.setLevel(logging.INFO)决定
logging.error(‘this is error’) #被记录-这个是由console.setLevel(logging.INFO)决定
- Python logging 模块简单实用
- [Python学习] Logging模块的简单使用
- Python的logging模块的简单应用
- [Python学习]Logging模块的简单使用
- python logging模块的简单使用
- Python Logging模块的简单使用
- 简单的logging模块调用(python)
- logging in python: logging模块的简单使用
- python模块 ---logging模块
- python logging模块学习
- Python标准模块logging
- Python标准模块logging
- python logging模块
- python 之logging模块
- python的logging模块
- Python标准模块logging
- [python相关]logging模块
- Python标准模块logging
- 二叉树的最大深度
- 无向图的割顶和桥(tarjan模板)
- Vijos1128.选数
- WPF中DependencyObject与DependencyProperty的源码简单剖析
- Linux进程间通信——消息队列
- Python logging 模块简单实用
- UBCF和IBCF的python实现和比较
- js中获取键盘事件
- zoj 1610 Count the Colors --线段树成段更新
- 矩形A + B
- 机试算法讲解: 第56题 多重背包之一起支援灾区
- 欢迎使用CSDN-markdown编辑器
- 分治法求最大连续和
- 找0的个数