dbrgn / tracing-test

Access and evaluate tracing logs in async and sync tests.
Apache License 2.0
52 stars 26 forks source link

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

Open parasyte opened 4 months ago

parasyte commented 4 months ago

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!()
}