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

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

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§

event
Create a new ExpectedEvent.
field
Construct a new ExpectedField.
has_contextual_parent
Convenience function that returns ExpectedAncestry::HasContextualParent with provided name.
has_explicit_parent
Convenience function that returns ExpectedAncestry::HasExplicitParent with provided name.
id
Returns a new, unset ExpectedId.
is_contextual_root
Convenience function that returns ExpectedAncestry::IsContextualRoot.
is_explicit_root
Convenience function that returns ExpectedAncestry::IsExplicitRoot.
msg
Construct a new message ExpectedField.
span
Construct a new ExpectedSpan.