Skip to main content

capture_tracing_output_async

Function capture_tracing_output_async 

Source
pub async fn capture_tracing_output_async(
    fut: impl Future<Output = ()>,
) -> String
Expand description

Async counterpart of capture_tracing_output, for a tracing emission inside an async fn/.awaited future.

Relies on a #[tokio::test] current-thread runtime polling fut on the same thread that installed the subscriber as the thread-local default.

ยงExamples

use deps_core::test_util::capture_tracing_output_async;

let output = capture_tracing_output_async(async {
    tracing::warn!("something rejected");
})
.await;
assert!(output.contains("something rejected"));