Skip to main content

LOG

Constant LOG 

Source
pub const LOG: &str = "# zag log\n\nAppend a custom structured event to a session log.\n\n## Synopsis\n\n    zag log <message> [options]\n    zag log --session <ID> <message> [options]\n\n## Description\n\nAppends a `UserEvent` to a session\'s JSONL log file. This allows external tools, CI scripts, hooks, and orchestrators to annotate the session timeline with structured events.\n\nThe session is resolved from `--session` or the `ZAG_SESSION_ID` environment variable (automatically set inside `zag run`/`exec` sessions).\n\nEvents injected via `zag log` flow through `listen`, `subscribe`, `events`, `search`, and `summary` with no extra configuration.\n\n## Arguments\n\n    message    The log message text\n\n## Flags\n\n    --session <ID>     Target session ID (defaults to ZAG_SESSION_ID env var)\n    --level <LEVEL>    Log level: info, warn, error, debug (default: info)\n    --data <JSON>      Arbitrary JSON data to attach to the event\n    -r, --root <PATH>  Root directory for session resolution\n\n## Examples\n\n    # Log from inside a session (auto-detects ZAG_SESSION_ID)\n    zag log \"deployment started\"\n\n    # Log with a specific level\n    zag log --level warn \"disk usage high\"\n\n    # Attach structured data\n    zag log \"tests passed\" --data \'{\"count\": 42, \"duration_ms\": 1200}\'\n\n    # Target a specific session from outside\n    zag log --session $sid \"build complete\" --level info\n\n## See Also\n\n`zag listen`, `zag events`, `zag subscribe`, `zag search`\n";