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

feat: Convert from &Verbosity to log / tracing #132

Closed
wants to merge 1 commit into from

Conversation

joshka
Copy link
Contributor

@joshka joshka commented Dec 14, 2024

This makes it possible to use a parsed args instance after using the
verbosity. E.g.:

let cli = Cli.parse();
tracing_subscriber::fmt()
    .with_max_level(&cli.verbosity)
    .init();
let foo = cli.some_other_arg;

// or
env_logger::Builder::new()
    .filter_level((&cli.verbosity).into())
    .init();
let foo = cli.some_other_arg;

This makes it possible to use a parsed args instance after using the
verbosity. E.g.:

```rust
let cli = Cli.parse();
tracing_subscriber::fmt()
    .with_max_level(&cli.verbosity)
    .init();
let foo = cli.some_other_arg;

// or
env_logger::Builder::new()
    .filter_level((&cli.verbosity).into())
    .init();
let foo = cli.some_other_arg;
```
@coveralls
Copy link

Pull Request Test Coverage Report for Build 12327031296

Details

  • 4 of 8 (50.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 50.0%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/tracing.rs 0 4 0.0%
Totals Coverage Status
Change from base Build 12101205082: 0.0%
Covered Lines: 52
Relevant Lines: 104

💛 - Coveralls

@joshka joshka changed the title feat: Convert from Verbosity ref to log / tracing feat: Convert from &Verbosity to log / tracing Dec 14, 2024
@epage
Copy link
Member

epage commented Dec 14, 2024

Alternatively, we can implement Copy. I assume it was paranoia over the implementation that I didn't. It would need some thought though.

Any preferences?

@joshka
Copy link
Contributor Author

joshka commented Dec 16, 2024

Copy would be a better solution to this. I'll shoot through a small PR with just that change.

@joshka joshka closed this Dec 16, 2024
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 this pull request may close these issues.

3 participants