Expand description
Logging: always-on JSONL, optional file log, crash reports.
Layout under [Config::data_dir]:
<data_dir>/
logs/unified.jsonl # structured events (append-only)
crash/crash-*.txt # panic reports
debug/whycodes-*.log # --debug / WHYCODES_LOG_FILE human logs
debug/latest.log # symlink (or copy) of the active debug logEnvironment:
RUST_LOG/WHYCODES_LOG_LEVEL— filter (e.g.debug,info,whycodes_agent=debug)WHYCODES_LOG_FILE— extra human-readable log path (verbatim)RUST_BACKTRACE— included in crash reports when set
Structs§
- Init
Options - Options for
init. - LogDirs
- Standard log / crash / debug directories under the data dir.
- LogEvent
- One line of
logs/unified.jsonl. - Logging
Handle - Handle returned by
init(cloneable path info).
Functions§
- append_
jsonl - Append a single JSON line to
path(creates parent dirs as needed). - clear_
panic_ cleanup - Clear the panic cleanup callback (e.g. after clean TUI exit).
- dirs
- Current log directories if init has run.
- emit
- Emit a structured event to the process-wide
unified.jsonl(no-op if not init’d). - emit_
sid - Like
emitbut attaches a session id. - format_
crash_ report - Build crash report text (no I/O). Public for tests.
- init
- Initialize process logging. Safe to call once; subsequent calls return the existing handle without re-installing the subscriber.
- is_
initialized - Whether logging has been initialized.
- set_
panic_ cleanup - Register a cleanup callback (e.g. leave alternate screen) run before crash I/O.
- write_
crash_ report - Format and write a crash report. Public for tests.