fix logging

This commit is contained in:
jxxghp 2023-08-15 08:22:49 +08:00
parent 5da3406647
commit 71c3dbcf3c
2 changed files with 5 additions and 3 deletions

View File

@ -111,8 +111,10 @@ def get_logging(token: str):
def log_generator():
log_path = settings.LOG_PATH / 'moviepilot.log'
texts = tailer.tail(open(log_path, 'r'), 50)
yield 'data: %s\n\n' % '\n'.join(texts)
# 读取文件末尾50行不使用tailer模块
with open(log_path, 'r') as f:
for line in f.readlines()[-50:]:
yield 'data: %s\n\n' % line
while True:
for text in tailer.follow(open(log_path, 'r')):
yield 'data: %s\n\n' % (text or '')

View File

@ -144,7 +144,7 @@ class TorrentHelper:
file_list = [torrentinfo.name]
else:
file_list = [fileinfo.name for fileinfo in torrentinfo.files]
logger.info(f"{torrent_path.stem} -> 目录:{folder_name},文件清单:{file_list}")
logger.debug(f"{torrent_path.stem} -> 目录:{folder_name},文件清单:{file_list}")
return folder_name, file_list
except Exception as err:
logger.error(f"种子文件解析失败:{err}")