1 Star 0 Fork 236

花酒廊 / jd_seckill

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
jd_logger.py 701 Bytes
一键复制 编辑 原始数据 按行查看 历史
huanghyw 提交于 2020-12-11 13:21 . 调整文件名及类名
import logging
import logging.handlers
'''
日志模块
'''
LOG_FILENAME = 'jd_seckill.log'
logger = logging.getLogger()
def set_logger():
logger.setLevel(logging.INFO)
formatter = logging.Formatter('%(asctime)s - %(process)d-%(threadName)s - '
'%(pathname)s[line:%(lineno)d] - %(levelname)s: %(message)s')
console_handler = logging.StreamHandler()
console_handler.setFormatter(formatter)
logger.addHandler(console_handler)
file_handler = logging.handlers.RotatingFileHandler(
LOG_FILENAME, maxBytes=10485760, backupCount=5, encoding="utf-8")
file_handler.setFormatter(formatter)
logger.addHandler(file_handler)
set_logger()
Python
1
https://gitee.com/sea_stray/jd_seckill.git
git@gitee.com:sea_stray/jd_seckill.git
sea_stray
jd_seckill
jd_seckill
master

搜索帮助