feat:插件日志文件独立

This commit is contained in:
jxxghp
2024-02-22 13:23:23 +08:00
parent 63643e6d26
commit cb274d1587
2 changed files with 110 additions and 24 deletions

View File

@ -160,7 +160,7 @@ def get_message(token: str):
@router.get("/logging", summary="实时日志")
def get_logging(token: str, length: int = 50):
def get_logging(token: str, length: int = 50, logfile: str = "moviepilot.log"):
"""
实时获取系统日志
length = -1 时, 返回text/plain
@ -172,7 +172,7 @@ def get_logging(token: str, length: int = 50):
detail="认证失败!",
)
log_path = settings.LOG_PATH / 'moviepilot.log'
log_path = settings.LOG_PATH / logfile
def log_generator():
# 读取文件末尾50行不使用tailer模块