This commit is contained in:
2026-02-03 17:14:11 -08:00
parent 1e0000ae19
commit cc19403087
6 changed files with 279 additions and 51 deletions

View File

@@ -562,26 +562,19 @@ def _run_op(op: str, data: Any) -> Dict[str, Any]:
}
def _helper_log_path() -> Path:
try:
d = _repo_root() / "Log"
d.mkdir(parents=True, exist_ok=True)
return d / "medeia-mpv-helper.log"
except Exception:
return Path(tempfile.gettempdir()) / "medeia-mpv-helper.log"
def _append_helper_log(text: str) -> None:
"""Log to database instead of file. This provides unified logging with rest of system."""
payload = (text or "").rstrip()
if not payload:
return
try:
path = _helper_log_path()
path.parent.mkdir(parents=True, exist_ok=True)
with open(path, "a", encoding="utf-8", errors="replace") as fh:
fh.write(payload + "\n")
# Try database logging first (best practice: unified logging)
from SYS.database import log_to_db
log_to_db("INFO", "mpv", payload)
except Exception:
return
# Fallback to stderr if database unavailable
import sys
print(f"[mpv-helper] {payload}", file=sys.stderr)
def _acquire_ipc_lock(ipc_path: str) -> Optional[Any]: