2013年6月17日

python logging

摘要: ogging模块包括logger,handler,filter,formatter这四个基本概念。logger: 提供日志接口,供应用代码使用。logger最长用的操作有两类:配置和发送日志消息。可以通过logging.getLogger(name)获取 logger对象,如果不指定name则返回root对象,多次使用相同的name调用getLogger方法返回同一个logger对象。handler: 将日志记录(log record)发送到合适的目的地(destination),比如文件,socket等。一个logger对象可以通过addHandler方法添加0 到多个handler,每个h 阅读全文

posted @ 2013-06-17 17:47 wangbokun 阅读(239) 评论(0) 推荐(0) 编辑

python 多线程一(lock)

摘要: '''Created on Jun 17, 2013@author: smp'''#-*- coding:utf-8 -*-import threadingimport timecounter = 0mutex=threading.Lock()class MyThread(threading.Thread): def __init__(self): threading.Thread.__init__(self) def run(self): global counter,mutex time.sleep(1); ... 阅读全文

posted @ 2013-06-17 16:13 wangbokun 阅读(152) 评论(0) 推荐(0) 编辑

导航