macro_rules! tracing_capture_event_fields {
( $code_under_test:block ) => { ... };
}
Expand description
This macro runs the given code block, collects any tracing Events emitted, and returns the Field/Value pairs carried by each event.
This utility macro is useful for callers only caring about the custom Field/Value data, and not necessarily the
complete Event
object.
Use it with
use tracing;
use tracing_assert_core::FieldValueMap;
use tracing_assert_macros::tracing_capture_event_fields;
fn foo() {
tracing::trace!("my event data!");
}
let events: Vec<FieldValueMap> = tracing_capture_event_fields!({foo()});