feat: unify runtime logging (rotating files, log root, scripts, desktop)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-05-14 10:11:51 +08:00
parent 86d4bad107
commit 1490bd5f24
25 changed files with 541 additions and 53 deletions

View file

@ -9,6 +9,7 @@ from dataclasses import dataclass
from pathlib import Path
from typing import Any
from svc.config.log_paths import oclaw_log_root
from svc.config.paths import db_path
@ -17,10 +18,7 @@ def _runtime_file() -> Path:
def _runtime_log_dir() -> Path:
p = str(os.getenv("AIA_RUNTIME_LOG_DIR") or "").strip()
if p:
return Path(p).expanduser().resolve()
return Path(db_path()).resolve().parent / "logs"
return oclaw_log_root()
def assistant_runtime_log_dir() -> Path:
@ -29,7 +27,7 @@ def assistant_runtime_log_dir() -> Path:
Same rule as ``AIA_RUNTIME_LOG_DIR`` or ``<parent of sqlite db_path>)/logs``.
Use this from shell scripts so paths match Python ``stack up`` / ``start_service``.
"""
return _runtime_log_dir()
return oclaw_log_root()
def _read_state() -> dict[str, Any]: