chore: alert_logger.py根目录副本同步到deploy权威版(硬链接归一后git同步,防deploy_guard回滚)

This commit is contained in:
xxm
2026-08-24 17:21:34 +08:00
parent 131d434079
commit 48a20adaa3
+17
View File
@@ -68,6 +68,23 @@ def record_alert(level="error", source="", title="", detail="", code="", clear_a
except Exception:
pass
# 2.5 写入 broadcast_messages 表(统一消息源,异常=system_error类)
try:
from messenger import _classify, DB
import sqlite3 as _sq3
_cat = _classify(title, detail)
# 异常/告警统一归为 system_error 类(供右上角异常浮窗筛选)
if level in ("error", "critical", "warning"):
_cat = "system_error"
_conn = _sq3.connect(DB, timeout=30)
_conn.execute(
"INSERT INTO broadcast_messages (ts, category, title, content, source) VALUES (?,?,?,?,?)",
(ts_str, _cat, title, detail, source))
_conn.commit()
_conn.close()
except Exception:
pass
# 3. XMPP 告警(非 info 级别才发,避免轰炸)→ 本地 XMPP 发送服务 :5805
if level != "info":
try: