Skip to content

Commit

Permalink
fix logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jxxghp committed Aug 15, 2023
1 parent 5da3406 commit 71c3dbc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions app/api/endpoints/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 '')
Expand Down
2 changes: 1 addition & 1 deletion app/helper/torrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def get_torrent_info(torrent_path: Path) -> Tuple[str, List[str]]:
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}")
Expand Down

0 comments on commit 71c3dbc

Please sign in to comment.