debug(audit): 添加X光调试-追踪断点

This commit is contained in:
DXC
2026-04-20 15:01:20 +08:00
parent 1c8def7e6f
commit decb7f5e1f
2 changed files with 21 additions and 2 deletions

View File

@ -319,6 +319,8 @@ def audit_log(module: str, action: str = None, get_target_id_fn=None, get_target
break
# 保存日志(统一入库)
print(f"📥 [X光-装饰器] 准备入库! details: {details}, g.audit_details: {getattr(g, 'audit_details', 'NOT_FOUND')}")
log_entry = AuditLog(
user_id=user_id,
username=username,
@ -338,6 +340,9 @@ def audit_log(module: str, action: str = None, get_target_id_fn=None, get_target
db.session.commit()
except Exception as e:
import traceback
traceback.print_exc()
print(f"💥 [X光-崩溃] 审计入库失败原因: {str(e)}")
current_app.logger.error(f"审计日志记录失败: {str(e)}")
db.session.rollback()