Use pretty_env_logger instead

This commit is contained in:
datdenkikniet 2023-04-15 10:10:04 +02:00
parent 480aa21059
commit 1ccca03a70
2 changed files with 7 additions and 8 deletions

View file

@ -7,7 +7,7 @@ publish = false
[dependencies] [dependencies]
anyhow = "1.0.43" anyhow = "1.0.43"
clap = { version = "4", features = ["derive"] } clap = { version = "4", features = ["derive"] }
env_logger = "0.10.0" pretty_env_logger = "0.4.0"
log = "0.4.17" log = "0.4.17"
rayon = "1.6.1" rayon = "1.6.1"
diffy = "0.3.0" diffy = "0.3.0"

View file

@ -20,7 +20,6 @@ use std::{
str, str,
}; };
use env_logger::Env;
use log::{debug, error, info, log_enabled, trace, Level}; use log::{debug, error, info, log_enabled, trace, Level};
use crate::{ use crate::{
@ -141,13 +140,13 @@ fn main() -> anyhow::Result<()> {
let globals = &cli.globals; let globals = &cli.globals;
let env_logger_default_level = match globals.verbose { let env_logger_default_level = match globals.verbose {
0 => Env::default().default_filter_or("info"), 0 => "info",
1 => Env::default().default_filter_or("debug"), 1 => "debug",
_ => Env::default().default_filter_or("trace"), _ => "trace",
}; };
env_logger::Builder::from_env(env_logger_default_level)
.format_module_path(false) pretty_env_logger::formatted_builder()
.format_timestamp(None) .parse_filters(&std::env::var("RUST_LOG").unwrap_or(env_logger_default_level.into()))
.init(); .init();
trace!("default logging level: {0}", globals.verbose); trace!("default logging level: {0}", globals.verbose);