rust-cli / rust-cli/env_logger

Dynamically change log level after `init`

Open
#228 6 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Is there currently a way to change the log level after having called init already? If there is currently no way, i would like to request this feature

Use case:
i would like to enable logging as the first thing in my code to have log output (from env, etc) and later after having parsed the cli (like with clap) set the level based on something like verbosity.
also another use case would be to dynamically turn the logging on / off for a specific part (which is probably already covered by #144)

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 by tracing the existing init API and how the environment-based log level is applied. Review the relationship to issue #144 and the stated CLI parsing use case. Done means the logger's level can be changed after initialization, including enabling or disabling logging for a later part of the program.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
observability
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.