tracing_capture_events

Macro tracing_capture_events 

Source
macro_rules! tracing_capture_events {
    ( $code_under_test:block ) => { ... };
}
Expand description

This macro runs the given code block, collects any tracing Events emitted, and returns them as a Vec<tracing_assert_core::Event>.

Invoke it with

use tracing;
use tracing_assert_core::Event;
use tracing_assert_macros::tracing_capture_events;

fn foo() {
    tracing::trace!("my event data!");
}

let events: Vec<Event> = tracing_capture_events!({foo()});