From 1ccca03a70b5d11dc03c046041138f73267af22a Mon Sep 17 00:00:00 2001 From: datdenkikniet Date: Sat, 15 Apr 2023 10:10:04 +0200 Subject: [PATCH] Use pretty_env_logger instead --- xtask/Cargo.toml | 2 +- xtask/src/main.rs | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index 1e7247a949..5609480bfa 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -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" diff --git a/xtask/src/main.rs b/xtask/src/main.rs index f2d01809ba..89ca0feb1f 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -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);