🛈 Note: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem.

For the release documentation, please see docs.rs, instead.

tracing_mock

Module expect

Source
Expand description

Construct expectations for traces which should be received

This module contains constructors for expectations defined in the event, span, and field modules.

§Examples

use tracing_mock::{collector, expect};

let (collector, handle) = collector::mock()
    // Expect an event with message
    .event(expect::event().with_fields(expect::msg("message")))
    .only()
    .run_with_handle();

tracing::collect::with_default(collector, || {
    tracing::info!("message");
});

handle.assert_finished();

Functions§