mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-11-28 23:16:35 +08:00
fix(log): 文件日志保留异常堆栈 (#7286)
未捕获异常经 localized_unhandled_exception_handler 写入文件日志时只保留正文,异常三元组未进入文件写入链路,导致 moviepilot.log 丢失异常类型与堆栈。现将 exc_info 在调用方线程规范化为三元组并随 LogEntry 携带到文件格式化器。
This commit is contained in:
committed by
InfinityPacer
parent
c301783bc2
commit
e550ec6dd8
@@ -40,9 +40,20 @@ class _CapturingLogWriter:
|
||||
"""
|
||||
self.entries: list[tuple[str, str, Path]] = []
|
||||
|
||||
def write_log(self, level: str, message: str, file_path: Path) -> None:
|
||||
def write_log(
|
||||
self,
|
||||
level: str,
|
||||
message: str,
|
||||
file_path: Path,
|
||||
exc_info: tuple | None = None,
|
||||
) -> None:
|
||||
"""
|
||||
保存单条日志的级别、内容和目标路径。
|
||||
|
||||
:param level: 日志等级名称
|
||||
:param message: 已经格式化的日志正文
|
||||
:param file_path: 目标日志文件路径
|
||||
:param exc_info: 已规范化的异常三元组,本测试写入器忽略该信息
|
||||
"""
|
||||
self.entries.append((level, message, file_path))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user