From 84aa897722265b35ed7a1721a87a598f74fe57ac Mon Sep 17 00:00:00 2001 From: MarkusJoe Date: Wed, 16 Feb 2022 13:21:54 +0800 Subject: [PATCH] =?UTF-8?q?heroku=20logger=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/utils/__init__.py | 4 ++-- bin/utils/logger.py | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/bin/utils/__init__.py b/bin/utils/__init__.py index b070592..8c9ff79 100644 --- a/bin/utils/__init__.py +++ b/bin/utils/__init__.py @@ -134,8 +134,8 @@ def single_download(url): if __name__ != '__main__': - if os.path.exists('./app.py') and not os.path.exists('./bin/log'): - os.mkdir('./bin/log') + if os.path.exists('./app.py') and not os.path.exists('./log'): + os.mkdir('./log') if not os.path.exists('./bin/assets/theme.db'): logger.error('没有检测到本地主题数据库即将开始下载') Check().download() diff --git a/bin/utils/logger.py b/bin/utils/logger.py index 539a499..1443dbb 100644 --- a/bin/utils/logger.py +++ b/bin/utils/logger.py @@ -6,8 +6,6 @@ # @File Name: logger.py -import os -import sys import time import logging.handlers from colorlog import ColoredFormatter @@ -38,7 +36,7 @@ class Logger: ConsoleLogger = logging.StreamHandler() # 输出到终端 ConsoleLogger.setFormatter(formatter) log_name = time.strftime('%Y-%m-%d %H') # 一小时内使用的日志文件都是同一个 - FileLogger = logging.handlers.RotatingFileHandler(filename=f'./bin/log/{log_name}.log', + FileLogger = logging.handlers.RotatingFileHandler(filename=f'./log/{log_name}.log', maxBytes=102400, backupCount=5) # 每个日志文件最大102400字节(100Kb) FileLogger.setFormatter(formatter_file)