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]
anyhow = "1.0.43"
clap = { version = "4", features = ["derive"] }
env_logger = "0.10.0"
pretty_env_logger = "0.4.0"
log = "0.4.17"
rayon = "1.6.1"
diffy = "0.3.0"

View file

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