test_traced

Attribute Macro test_traced 

Source
#[test_traced]
Expand description

Capture logs (based on the provided log level) from a test run using libtest’s output capture functionality.

This macro defaults to a log level of DEBUG if no level is provided.

This macro is powered by the tracing and tracing-subscriber crates.

§Example

use commonware_macros::test_traced;
use tracing::{debug, info};

#[test_traced("INFO")]
fn test_info_level() {
    info!("This is an info log");
    debug!("This is a debug log (won't be shown)");
    assert_eq!(2 + 2, 4);
}