f
This commit is contained in:
@@ -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]:
|
||||
|
||||
Reference in New Issue
Block a user