logging

import logging
from logging import handlers

def logging_handler(flag, msgs):

rh = handlers.RotatingFileHandler('daxiao.log', maxBytes=126, backupCount=5, encoding='utf-8')
th = handlers.TimedRotatingFileHandler(filename='time.log', when='s', interval=5, encoding='utf-8')

fh = logging.FileHandler(filename="xxx.log", encoding="utf-8")
sh = logging.StreamHandler()

logging.basicConfig(format="%(asctime)s - %(name)s - [%(lineno)d] - %(levelname)s - %(module)s: %(message)s",
                    datefmt="%Y-%m-%d %H:%M:%S",
                    handlers=[fh, sh, rh, th],
                    level=logging.DEBUG)
posted @ 2020-11-11 17:10  雁飞残月天  阅读(51)  评论(0)    收藏  举报