Skip to main content

record_subscriber_with_failure

Function record_subscriber_with_failure 

Source
pub fn record_subscriber_with_failure<Sink>(
    filter: EnvFilter,
    limits: FormatterLimits,
    sink: Sink,
    failure: impl Fn() + Send + Sync + 'static,
) -> (impl Subscriber + Send + Sync, RecordStatus)
where Sink: Fn(&[u8]) -> Result<()> + Send + Sync + 'static,
Expand description

Prepare without installing a subscriber or opening a destination.

filter must already be resolved by the caller. Records use the standard Full format with timestamps and generated ANSI disabled. Stock sanitizes the message field and error values; arbitrary named Debug fields preserve their original bytes, including escape sequences. Inspect the retained status after emitter quiescence, including teardown; absence of a local failure alone is not a complete-log or parity verdict. The callback is invoked once on the first local failure, after storing it.

The emitted byte stream is not self-describing on failure: it can be an incomplete prefix with no marker. A consumer feeding it to detcore::logdiff must ensure any failure refuses comparison, either through retained failure state or an in-band marker recognized by the comparator as truncation. The bytes alone cannot qualify a comparison. Transport wiring must enforce this before this preparation can be used for backend verification.