<>logging 日志模块
2015-05-30 15:33
477 查看
使用 logging 的一般步骤: import logging logger = logging.getLogger() hdlr = logging.FileHandler('/tmp/sendlog.txt') formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') hdlr.setFormatter(formatter) logger.addHandler(hdlr) logger.setLevel(logging.NOTSET) logger.debug('this is a DEBUG message!') logger.error('this is an ERROR message!') 打开 /tmp/sendlog.txt 可以看到 2015-05-05 16:13:49,084 DEBUG this is a DEBUG message! 2015-05-05 16:13:49,108 ERROR this is an ERROR message!
相关文章推荐
- 12周项目二
- 三层架构与MVC
- Jquery.Page.js 分页插件的使用
- javascript基础(第三天)
- Web Service实践之REST vs RPC
- list之key
- isinstance()类型检测
- len
- malloc,指针,throw的总结
- Poj(2352)——Stars(树状数组)
- 支付宝手机网页即时到账接口(5)之交易接口页面跳转同步通知
- android开发环境
- 在Fragment之间切换,getActivity()为null的处理
- lambda表达式
- Android中Matrix的pre post set方法理解
- COJ 1002 WZJ的数据结构(二)(splay模板)
- javascript基础(第二天)
- ASP.NET MVC 必备开发环境
- ./scripts/feeds update -a OpenWrt大招系列
- import this