pub struct Diagnostics { /* private fields */ }Expand description
The write-only logging surface.
Holding one is the only way to write a log line in this crate, and it offers no way to read one back.
Implementations§
Source§impl Diagnostics
impl Diagnostics
Sourcepub fn new(floor: Level, sink: Sink) -> Diagnostics
pub fn new(floor: Level, sink: Sink) -> Diagnostics
Writes every level at or before floor to sink.
Sourcepub fn off() -> Diagnostics
pub fn off() -> Diagnostics
Writes nothing at all. The state the deletion-invariance test runs in, and a legitimate way to run the city.
Sourcepub fn admits(&self, level: Level) -> bool
pub fn admits(&self, level: Level) -> bool
Whether a level would be written. Offered so a caller can skip building an expensive message, not so it can branch on it.
Sourcepub fn write(&mut self, level: Level, site: Site<'_>, message: &str)
pub fn write(&mut self, level: Level, site: Site<'_>, message: &str)
Writes one line, if the floor admits it.
The message passes the same secret scan the Ledger uses — the
same function, not a second one, because the scanner nobody
watches is the one that misses something. A hit is replaced in
place: dropping the line would lose the diagnostic entirely, and
the surrounding words are usually what the reader needed. A log
line marks plainly: see crate::redact::Marker for why history
and a log differ in that one argument and in nothing else.