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

@ -5,6 +5,8 @@ import os
from pathlib import Path
from typing import Any, Dict
from svc.config.log_paths import oclaw_hooks_log_dir
def _resolve_state_dir() -> Path:
# Keep this compatible with typical Oclaw layouts.
@ -18,9 +20,7 @@ def handle(event) -> None:
if getattr(event, "type", None) != "command":
return
state_dir = _resolve_state_dir()
log_dir = state_dir / "logs"
log_dir.mkdir(parents=True, exist_ok=True)
log_dir = oclaw_hooks_log_dir(state_dir_if_legacy=_resolve_state_dir())
payload: Dict[str, Any] = {
"timestamp": getattr(getattr(event, "timestamp", None), "isoformat", lambda: None)(),