rust-lang / bors

Rust implementation of bors used for various Rust components (e.g. the compiler).
Apache License 2.0
46 stars 20 forks source link

Enable logs in tests #177

Closed MarcoIeni closed 1 week ago

MarcoIeni commented 2 weeks ago

The logs are super useful. For example I was debugging #174 and by enabling logs I saw the following which is very useful:

Image

It would be nice to enable logs for all tests by default.

I copy pasted the following to enable logs:

    tracing_subscriber::fmt()
        .with_env_filter(
            EnvFilter::builder()
                .with_default_directive(tracing::Level::INFO.into())
                .from_env()
                .expect("Cannot load RUST_LOG"),
        )
        .init();

What do you think?

Kobzol commented 2 weeks ago

We already depend on https://docs.rs/tracing-test/latest/tracing_test/. You can just slap #[traced_test] on top of a test to enable tracing log output in that test. I guess it would be nice to add this to the development documentation :)