Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable logs in tests #177

Open
MarcoIeni opened this issue Nov 15, 2024 · 1 comment · May be fixed by #178
Open

Enable logs in tests #177

MarcoIeni opened this issue Nov 15, 2024 · 1 comment · May be fixed by #178
Assignees

Comments

@MarcoIeni
Copy link
Member

MarcoIeni commented Nov 15, 2024

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
Copy link
Contributor

Kobzol commented Nov 15, 2024

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 :)

@MarcoIeni MarcoIeni self-assigned this Nov 17, 2024
@MarcoIeni MarcoIeni linked a pull request Nov 19, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants