This commit is contained in:
2026-03-25 00:56:58 -07:00
parent 96f327e4dc
commit c31402c8f1
5 changed files with 89 additions and 12 deletions

View File

@@ -1120,7 +1120,7 @@ def _run_op(op: str, data: Any) -> Dict[str, Any]:
def _append_helper_log(text: str) -> None:
"""Log to database instead of file. This provides unified logging with rest of system."""
"""Log helper diagnostics to file, database, and the mpv console emitter."""
payload = (text or "").rstrip()
if not payload:
return
@@ -1129,6 +1129,12 @@ def _append_helper_log(text: str) -> None:
if len(_HELPER_LOG_BACKLOG) > _HELPER_LOG_BACKLOG_LIMIT:
del _HELPER_LOG_BACKLOG[:-_HELPER_LOG_BACKLOG_LIMIT]
try:
with open(_helper_log_path(), "a", encoding="utf-8", errors="replace") as fh:
fh.write(f"[{time.strftime('%Y-%m-%d %H:%M:%S')}] {payload}\n")
except Exception:
pass
try:
# Try database logging first (best practice: unified logging)
from SYS.database import log_to_db