Function tracing_forest::test_init

source ·
pub fn test_init() -> Result<(), TryInitError>
Expand description

Initializes a global subscriber for cargo tests with a ForestLayer using the default configuration.

This function is intended for test case initialization and processes log trees “inline”, meaning it doesn’t take advantage of a worker task for formatting and writing.

Examples

use tracing::{info, info_span};

let _ = tracing_forest::test_init();

info!("Hello, world!");
info_span!("my_span").in_scope(|| {
    info!("Relevant information");
});