tracing-test icon indicating copy to clipboard operation
tracing-test copied to clipboard

Capture logs from the `log` crate with `tracing-log`

Open parasyte opened this issue 2 years ago • 0 comments

tracing-log can capture logs from the log crate, it just needs to be initialized by the proc-macro. This is a nice complement to the no-env-filter feature added in #16. Especially when you have dependencies that use log and you need tests to capture those logs for failure analysis.

My current workaround is adding the init manually to every test:

#[test]
#[traced_test]
fn test_frobnicator() {
    let _ = tracing_log::LogTracer::init();

    todo!()
}

parasyte avatar Feb 26 '24 23:02 parasyte