Skip to main content

Module log_sink

Module log_sink 

Source
Expand description

Asynchronous log file sink.

See SRD-02 §“Display and Diagnostic Decoupling” for the design tenet. Producers (anyone calling diag!() / observer::log()) try_send a fully-formatted line into a bounded channel and return immediately. A dedicated log-sink OS thread is the only writer to the file — syscalls, locking, fsync stalls all happen there, never on a tokio worker.

Overflow policy: bounded channel + try_send. If the sink falls behind (slow disk, full disk, NFS hang), producers drop the line and bump a dropped_count counter. Diagnostics never block the runtime; the dropped count is visible through the inspector endpoint and the post-run summary so the operator knows when log loss occurred.

Structs§

LogSink
Producer side of the async log sink.

Functions§

global
Borrow the global log sink, if initialized. Used by the log() hot path and by the inspector to report the dropped count.
init
Initialize the global log sink with a target file. Called once by the runner after the session directory exists. Silently no-ops on a second call — the first session wins, matching the previous behavior of set_log_file.