1
0
mirror of https://github.com/hanxi/xiaomusic.git synced 2026-04-23 22:10:11 +08:00

fix: 修复日志文件删除失败的问题

This commit is contained in:
涵曦
2025-06-14 22:51:27 +08:00
parent 778d8f8b9d
commit c2cb13e61e

View File

@@ -171,7 +171,10 @@ class XiaoMusic:
if log_path and not os.path.exists(log_path):
os.makedirs(log_path)
if os.path.exists(log_file):
os.remove(log_file)
try:
os.remove(log_file)
except Exception as e:
self.log.warning(f"无法删除旧日志文件: {log_file} {e}")
handler = RotatingFileHandler(
self.config.log_file,
maxBytes=10 * 1024 * 1024,