mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-11 07:00:48 +08:00
feat: unify runtime logging (rotating files, log root, scripts, desktop)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
86d4bad107
commit
1490bd5f24
25 changed files with 541 additions and 53 deletions
|
|
@ -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)(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue