# encoding:utf-8 import logging import time class Logs: def __init__(self): self.logger = logging.getLogger() def writeLog(self): err = True self.logger.setLevel(level = logging.INFO) filename = time.strftime('%Y-%m-%d', time.localtime(time.time())) handler = logging.FileHandler('./log/' + filename + '.log') handler.setLevel(logging.INFO) formatter = logging.Formatter('%(asctime)s - %(message)s') handler.setFormatter(formatter) self.logger.addHandler(handler) def outPut(self,message): self.logger.info(message)