From e76606823f090c4a4149e21db572a3ffb278f1a8 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Tue, 15 Aug 2023 07:12:12 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E6=97=A5=E5=BF=97=E9=A6=96=E6=AC=A1?= =?UTF-8?q?=E8=AF=BB=E5=8F=96=E9=83=A8=E5=88=86=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/endpoints/system.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/api/endpoints/system.py b/app/api/endpoints/system.py index 31c66633..b5bf484e 100644 --- a/app/api/endpoints/system.py +++ b/app/api/endpoints/system.py @@ -110,8 +110,11 @@ def get_logging(token: str): ) def log_generator(): + log_path = settings.LOG_PATH / 'moviepilot.log' + texts = tailer.tail(open(log_path, 'r'), 50) while True: - for text in tailer.follow(open(settings.LOG_PATH / 'moviepilot.log')): + yield 'data: %s\n\n' % '\n'.join(texts) + for text in tailer.follow(open(log_path, 'r')): yield 'data: %s\n\n' % (text or '') time.sleep(1)