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

Always exclude certain dependencies from logging #234

Open
kornelski opened this issue Jun 16, 2022 · 2 comments
Open

Always exclude certain dependencies from logging #234

kornelski opened this issue Jun 16, 2022 · 2 comments

Comments

@kornelski
Copy link

I'd like to have RUST_LOG env variable to work as usual, except never log anything from a couple of noisy dependencies.

I thought this would do the trick:

        let _ = env_logger::Builder::from_default_env()
            .filter(Some("html5ever"), log::LevelFilter::Off)
            .filter(Some("tantivy"), log::LevelFilter::Off)
            .try_init();

but it seems that RUST_LOG=debug enables debug output even for the dependencies I'm trying to filter out.

Is there a way to gracefully combine env vars and explicit filters, with my filter() calls taking precedence?

@slientgoat
Copy link

RUST_LOG=DEBUG,html5ever=off,tantivy=off

@kornelski
Copy link
Author

kornelski commented Aug 23, 2022

I know it's possible to set it manually every time, but my whole point is that I would like to avoid having to do this the long way, and provide a better default. In other words I'd like:

  • RUST_LOG=debug to behave like RUST_LOG=debug,html5ever=off,tantivy=off, and ideally
  • RUST_LOG=debug,html5ever=on to behave like RUST_LOG=debug,html5ever=on,tantivy=off

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants