fix: warn of unused loglevel
Some checks are pending
Conventional Commits / Conventional Commits (push) Waiting to run

Fix: #15
Signed-off-by: Christina Sørensen <christina@cafkafk.com>
This commit is contained in:
Christina Sørensen 2024-09-05 08:23:40 +02:00
parent 6e479e7ad2
commit 3f632969a9
Signed by: cafkafk
GPG key ID: 26C542FD97F965CE

View file

@ -35,10 +35,13 @@ async fn main() -> io::Result<()> {
let matches = cli::build_cli().get_matches(); 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 match matches
.get_one::<u8>("verbose") .get_one::<u8>("verbose")
.expect("Count's are defaulted") .expect("Counts aren't defaulted")
{ {
0 => env::set_var("RUST_LOG", "error"), 0 => env::set_var("RUST_LOG", "error"),
1 => env::set_var("RUST_LOG", "warn"), 1 => env::set_var("RUST_LOG", "warn"),
@ -46,7 +49,7 @@ async fn main() -> io::Result<()> {
3 => env::set_var("RUST_LOG", "debug"), 3 => env::set_var("RUST_LOG", "debug"),
4 => env::set_var("RUST_LOG", "trace"), 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") env::set_var("RUST_LOG", "trace")
} }
} }
@ -61,6 +64,10 @@ async fn main() -> io::Result<()> {
.init(); .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") { if let Some(name) = matches.get_one::<String>("name") {
host_name = name.to_owned(); host_name = name.to_owned();
} else { } else {