pub struct SessionTracer { /* private fields */ }Expand description
Appends events to a session’s trace.jsonl.
A new instance is built via SessionTracer::begin, events are
appended with SessionTracer::event, and the session is finalised
with SessionTracer::end. Dropping a tracer without calling end
leaves the trace.jsonl intact but does not write meta.json — the
stream still round-trips, just without the convenience summary.
Implementations§
Source§impl SessionTracer
impl SessionTracer
Sourcepub fn begin(skill: &str, target: &TraceTarget) -> Result<Self>
pub fn begin(skill: &str, target: &TraceTarget) -> Result<Self>
Start a new session. Creates a unique directory
<root>/<date>/<skill>/<session_id>/ and opens trace.jsonl
for append. The per-session directory ensures that concurrent
or repeated invocations of the same skill on the same day do
not share any files (ADR-015 requires self-contained sessions).
Sourcepub fn event(&self, phase: Phase, payload: Value) -> Result<()>
pub fn event(&self, phase: Phase, payload: Value) -> Result<()>
Append one event to the trace. Payload is redacted before writing.
Sourcepub fn end(self, outcome: Outcome, summary: &str) -> Result<()>
pub fn end(self, outcome: Outcome, summary: &str) -> Result<()>
Record the final end event and write the per-session
meta.json. Consumes the tracer.
Sourcepub fn session_dir(&self) -> &Path
pub fn session_dir(&self) -> &Path
The session directory on disk.
Sourcepub fn trace_path(&self) -> &Path
pub fn trace_path(&self) -> &Path
The trace.jsonl path.
Sourcepub fn session_id(&self) -> &str
pub fn session_id(&self) -> &str
The session id (ULID, or a randomly-generated fallback when the
trace Cargo feature is disabled).