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::HasContextualParentwith provided name. - has_
explicit_ parent - Convenience function that returns
ExpectedAncestry::HasExplicitParentwith 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.