rust-cli / rust-cli/env_logger

Set default level

Open
#162 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
1.1k
Forks
149
Avg merge
2h 42m
Merged PRs (30d)
4

Description

The docs recommend the following snippet to set the default level to, e.g., "warn":

env_logger::from_env(Env::default().default_filter_or("warn")).init();

However, this does not work as expected: what I would expect is that when setting RUST_LOG=some::module=info, all the other modules are still subject to the default level, "warn". However, default_filter_or says

Use the default environment variable to read the filter from.

If the variable is not set, the default value will be used.

So, once RUST_LOG is set, the default for all unspecified modules is "error" again.

Is there any way to truly change the default level for unspecified modules? If not, this is a feature request to add such an option. :)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the documented env_logger::from_env(Env::default().default_filter_or("warn")) entry point and compare its behavior when RUST_LOG is unset versus some::module=info. Determine whether the existing environment-filter semantics support a separate fallback level for unspecified modules; done means the requested default behavior is defined and covered by an appropriate test or documented as unsupported.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.