import logging
import logging.handlers
def initLogger(name):
Logger = logging.getLogger(name)
Logger.setLevel(logging.INFO)
RFhandler = logging.handlers.RotatingFileHandler(filename = name,maxBytes = 10*1024*1024,backupCount = 5)
formatter = logging.Formatter('[python] %(asctime)s %(levelname)s [%(thread)d] (%(pathname)-s:%(lineno)d) - %(message)s')
RFhandler.setFormatter(formatter)
Logger.addHandler(RFhandler)
return Logger
阅读(594) | 评论(0) | 转发(0) |