Initialise logger earlier

This commit is contained in:
Ingvar Stepanyan 2020-04-20 12:10:13 +01:00
parent 46bbee19f7
commit 37459b8df3

View file

@ -313,6 +313,14 @@ fn collect_files(
fn parse_opts_into_struct(
matches: &ArgMatches,
) -> Result<(OutFile, Option<PathBuf>, 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::<u8>() {
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;
}