Skip to content

Commit

Permalink
fix: warn of unused loglevel
Browse files Browse the repository at this point in the history
Fix: #15
Signed-off-by: Christina Sørensen <[email protected]>
  • Loading branch information
cafkafk committed Sep 5, 2024
1 parent 6e479e7 commit 3f63296
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions crates/nix-weather/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,21 @@ async fn main() -> io::Result<()> {

let matches = cli::build_cli().get_matches();

// TODO
/// If the users inputs more -v flags than we have log levels, send them a
/// message informing them.
let mut very_bose = false;

match matches
.get_one::<u8>("verbose")
.expect("Count's are defaulted")
.expect("Counts aren't defaulted")
{
0 => env::set_var("RUST_LOG", "error"),
1 => env::set_var("RUST_LOG", "warn"),
2 => env::set_var("RUST_LOG", "info"),
3 => env::set_var("RUST_LOG", "debug"),
4 => env::set_var("RUST_LOG", "trace"),
_ => {
log::trace!("More than four -v flags don't increase log level.");
very_bose = true;
env::set_var("RUST_LOG", "trace")
}
}
Expand All @@ -61,6 +64,10 @@ async fn main() -> io::Result<()> {
.init();
}

if very_bose {
log::trace!("More than four -v flags don't increase log level.");
}

if let Some(name) = matches.get_one::<String>("name") {
host_name = name.to_owned();
} else {
Expand Down

0 comments on commit 3f63296

Please sign in to comment.