fn run_and_get_raw_output<F: Fn()>(action: F) -> String {
    let mut default_fields = HashMap::new();
    default_fields.insert("custom_field".to_string(), json!("custom_value"));
    let formatting_layer = BunyanFormattingLayer::with_default_fields("test".into(), || MockWriter::new(&BUFFER), default_fields);
    let subscriber = Registry::default()
        .with(JsonStorageLayer)
        .with(formatting_layer);
    tracing::subscriber::with_default(subscriber, action);

    // Return the formatted output as a string to make assertions against
    let mut buffer = BUFFER.lock().unwrap();
    let output = buffer.to_vec();
    // Clean the buffer to avoid cross-tests interactions
    buffer.clear();
    String::from_utf8(output).unwrap()
}
// Run a closure and collect the output emitted by the tracing instrumentation using an in-memory buffer.
Run a closure and collect the output emitted by the tracing instrumentation using an in-memory buffer.
Run a closure and collect the output emitted by the tracing instrumentation using an in - memory buffer .
fn run_and_get_raw_output<F: Fn()>(action: F) -> String {
    let mut default_fields = HashMap::new();
    default_fields.insert("custom_field".to_string(), json!("custom_value"));
    let formatting_layer = BunyanFormattingLayer::with_default_fields("test".into(), || MockWriter::new(&BUFFER), default_fields);
    let subscriber = Registry::default()
        .with(JsonStorageLayer)
        .with(formatting_layer);
    tracing::subscriber::with_default(subscriber, action);
    // Return the formatted output as a string to make assertions against
    let mut buffer = BUFFER.lock().unwrap();
    let output = buffer.to_vec();
    // Clean the buffer to avoid cross-tests interactions
    buffer.clear();
    String::from_utf8(output).unwrap()
}
fn run_and_get_raw_output < F : Fn ( ) > ( action : F ) -> String { let mut default_fields = HashMap :: new ( ) ; default_fields . insert ( " " . to_string ( ) , json ! ( " " ) ) ; let formatting_layer = BunyanFormattingLayer :: with_default_fields ( " " . into ( ) , | | MockWriter :: new ( & BUFFER ) , default_fields ) ; let subscriber = Registry :: default ( ) . with ( JsonStorageLayer ) . with ( formatting_layer ) ; tracing :: subscriber :: with_default ( subscriber , action ) ; // Return the formatted output as a string to make assertions against let mut buffer = BUFFER . lock ( ) . unwrap ( ) ; let output = buffer . to_vec ( ) ; // Clean the buffer to avoid cross-tests interactions buffer . clear ( ) ; String :: from_utf8 ( output ) . unwrap ( ) }
Run a closure and collect the output emitted by the tracing instrumentation using an in-memory buffer.
Run a closure and collect the output emitted by the tracing instrumentation using an in - memory buffer .
action
F
action
F