From 37459b8df32c67eafb5eb3fed697b3b6f1bbc88b Mon Sep 17 00:00:00 2001 From: Ingvar Stepanyan Date: Mon, 20 Apr 2020 12:10:13 +0100 Subject: [PATCH] Initialise logger earlier --- src/main.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main.rs b/src/main.rs index b39a36fb..8777449d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -313,6 +313,14 @@ fn collect_files( fn parse_opts_into_struct( matches: &ArgMatches, ) -> Result<(OutFile, Option, Options), String> { + stderrlog::new() + .module(module_path!()) + .quiet(matches.is_present("quiet")) + .verbosity(if matches.is_present("verbose") { 3 } else { 2 }) + .show_level(false) + .init() + .unwrap(); + let mut opts = if let Some(x) = matches.value_of("optimization") { if let Ok(opt) = x.parse::() { Options::from_preset(opt) @@ -397,14 +405,6 @@ fn parse_opts_into_struct( opts.preserve_attrs = true; } - stderrlog::new() - .module(module_path!()) - .quiet(matches.is_present("quiet")) - .verbosity(if matches.is_present("verbose") { 3 } else { 2 }) - .show_level(false) - .init() - .unwrap(); - if matches.is_present("no-bit-reduction") { opts.bit_depth_reduction = false; }