rust-cli / rust-cli/env_logger
Always exclude certain dependencies from logging
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.1k
- Forks
- 149
- Avg merge
- 2h 42m
- Merged PRs (30d)
- 4
Description
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?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading env_logger::Builder::from_default_env and the filter() behavior, then reproduce the interaction with RUST_LOG=debug and explicit filters for html5ever and tantivy. Done means documenting or implementing a defined precedence rule where explicit filters can remain disabled while the environment configures other logging.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- observability
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100