pub struct Handle { /* private fields */ }Expand description
A live logger handle suitable for inclusion in module health reports.
Implementations§
Source§impl Handle
impl Handle
Sourcepub fn swallowed_writes(&self) -> u64
pub fn swallowed_writes(&self) -> u64
Returns the number of lines dropped after a write failure.
Sourcepub fn fallback_active(&self) -> bool
pub fn fallback_active(&self) -> bool
Reports whether opening the directory failed and events are going to stderr.
Sourcepub fn emit_at(
&self,
at: SystemTime,
level: Level,
logger: &str,
message: &str,
fields: &[(String, String)],
)
pub fn emit_at( &self, at: SystemTime, level: Level, logger: &str, message: &str, fields: &[(String, String)], )
Writes one line stamped with at into the segment at names, instead
of the one the logger’s clock names now.
For a record that must sit beside lines written under a different clock
reading. The case it exists for is a wall-clock step: the lines before
the step went to the segment the old clock named, so a marker describing
them belongs there too, stamped the way its neighbours are, or a reader
opening that file finds the lines and not the warning. Not level-filtered
(CK_LOG does not apply) and not for routine logging, which goes through
tracing so filtering and span context hold.
Sourcepub fn emit_at_with_bound(
&self,
at: SystemTime,
level: Level,
logger: &str,
bound: &[(String, String)],
message: &str,
fields: &[(String, String)],
)
pub fn emit_at_with_bound( &self, at: SystemTime, level: Level, logger: &str, bound: &[(String, String)], message: &str, fields: &[(String, String)], )
Handle::emit_at with bound fields too, for a writer that renders on a
thread other than the one that produced the event (for example a queue
drained by a dedicated log thread). Such a writer cannot rely on the
caller’s tracing span, so it carries the context itself: bound is
rendered in the bracket after the process-level fields, replacing a
process-level field of the same key. Not level-filtered (CK_LOG does
not apply); the producer decides what to enqueue.
Sourcepub fn install_panic_hook(&self)
pub fn install_panic_hook(&self)
Installs the panic hook init installs: the panic text and a forced
backtrace go into the segment, one line each on logger
<module>.panic, and the previous hook still runs (the default one
prints to stderr). For a caller that composed the layer itself with
layer or layer_with_stderr_copy. Call it once; each call chains
another hook.