mirror of
https://github.com/JefferyHcool/BiliNote.git
synced 2026-07-27 08:47:47 +08:00
feat(app): 添加日志记录功能
- 新增 logger 模块,用于全局日志记录 - 在关键位置添加日志输出,包括事件处理、文件清理、FFmpeg 检查等 - 优化数据库操作,增加日志记录 - 在主程序启动时添加日志输出
This commit is contained in:
@@ -1,8 +1,14 @@
|
||||
# 注册监听器
|
||||
from app.utils.logger import get_logger
|
||||
from events.handlers import cleanup_temp_files
|
||||
from events.signals import transcription_finished
|
||||
|
||||
logger = get_logger(__name__)
|
||||
|
||||
def register_handler():
|
||||
transcription_finished.connect(cleanup_temp_files)
|
||||
try:
|
||||
transcription_finished.connect(cleanup_temp_files)
|
||||
logger.info("注册监听器成功")
|
||||
except Exception as e:
|
||||
logger.error(f"注册监听器失败:{e}")
|
||||
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
import os
|
||||
|
||||
from app.utils.logger import get_logger
|
||||
logger = get_logger(__name__)
|
||||
|
||||
def cleanup_temp_files(data):
|
||||
print(f"🧹 清理转写文件:{data['file_path']}")
|
||||
logger.info(f"starting cleanup temp files :{data['file_path']}")
|
||||
os.remove(data['file_path'])
|
||||
# 检查是否删除文件
|
||||
if os.path.exists(data['file_path']):
|
||||
logger.info(f"cleanup temp files failed :{data['file_path']}")
|
||||
else:
|
||||
logger.info(f"cleanup temp files success :{data['file_path']}")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user