diff options
Diffstat (limited to 'src/args.rs')
-rw-r--r-- | src/args.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/args.rs b/src/args.rs index a0c1d7db..f544db49 100644 --- a/src/args.rs +++ b/src/args.rs @@ -10,7 +10,6 @@ use std::sync::atomic::{AtomicBool, Ordering}; use clap; use encoding_rs::Encoding; -use env_logger; use grep::{Grep, GrepBuilder, Error as GrepError}; use log; use num_cpus; @@ -27,6 +26,7 @@ use printer::{ColorSpecs, Printer}; use unescape::unescape; use worker::{Worker, WorkerBuilder}; +use logger::Logger; use Result; /// `Args` are transformed/normalized from `ArgMatches`. @@ -91,14 +91,13 @@ impl Args { pub fn parse() -> Result<Args> { let matches = app::app().get_matches(); - let mut logb = env_logger::LogBuilder::new(); + if let Err(err) = Logger::init() { + errored!("failed to initialize logger: {}", err); + } if matches.is_present("debug") { - logb.filter(None, log::LogLevelFilter::Debug); + log::set_max_level(log::LevelFilter::Debug); } else { - logb.filter(None, log::LogLevelFilter::Warn); - } - if let Err(err) = logb.init() { - errored!("failed to initialize logger: {}", err); + log::set_max_level(log::LevelFilter::Warn); } ArgMatches(matches).to_args() } |