Move logger initialization to earliest possible point
This commit is contained in:
parent
f8c9234a7a
commit
d6aa42bd60
6 changed files with 9 additions and 13 deletions
|
@ -49,8 +49,6 @@ fn main() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
rt.init_logger();
|
|
||||||
|
|
||||||
debug!("Hello. Logging was just enabled");
|
debug!("Hello. Logging was just enabled");
|
||||||
debug!("I already set up the Runtime object and build the commandline interface parser.");
|
debug!("I already set up the Runtime object and build the commandline interface parser.");
|
||||||
debug!("Lets get rollin' ...");
|
debug!("Lets get rollin' ...");
|
||||||
|
|
|
@ -40,8 +40,6 @@ fn main() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
rt.init_logger();
|
|
||||||
|
|
||||||
debug!("Hello. Logging was just enabled");
|
debug!("Hello. Logging was just enabled");
|
||||||
debug!("I already set up the Runtime object and build the commandline interface parser.");
|
debug!("I already set up the Runtime object and build the commandline interface parser.");
|
||||||
debug!("Lets get rollin' ...");
|
debug!("Lets get rollin' ...");
|
||||||
|
|
|
@ -41,8 +41,6 @@ fn main() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
rt.init_logger();
|
|
||||||
|
|
||||||
debug!("Hello. Logging was just enabled");
|
debug!("Hello. Logging was just enabled");
|
||||||
debug!("I already set up the Runtime object and build the commandline interface parser.");
|
debug!("I already set up the Runtime object and build the commandline interface parser.");
|
||||||
debug!("Lets get rollin' ...");
|
debug!("Lets get rollin' ...");
|
||||||
|
|
|
@ -37,8 +37,6 @@ fn main() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
rt.init_logger();
|
|
||||||
|
|
||||||
debug!("Hello. Logging was just enabled");
|
debug!("Hello. Logging was just enabled");
|
||||||
debug!("I already set up the Runtime object and build the commandline interface parser.");
|
debug!("I already set up the Runtime object and build the commandline interface parser.");
|
||||||
debug!("Lets get rollin' ...");
|
debug!("Lets get rollin' ...");
|
||||||
|
|
|
@ -45,8 +45,6 @@ fn main() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
rt.init_logger();
|
|
||||||
|
|
||||||
debug!("Hello. Logging was just enabled");
|
debug!("Hello. Logging was just enabled");
|
||||||
debug!("I already set up the Runtime object and build the commandline interface parser.");
|
debug!("I already set up the Runtime object and build the commandline interface parser.");
|
||||||
debug!("Lets get rollin' ...");
|
debug!("Lets get rollin' ...");
|
||||||
|
|
|
@ -39,6 +39,12 @@ impl<'a> Runtime<'a> {
|
||||||
use configuration::error::ConfigErrorKind;
|
use configuration::error::ConfigErrorKind;
|
||||||
|
|
||||||
let matches = cli_spec.get_matches();
|
let matches = cli_spec.get_matches();
|
||||||
|
|
||||||
|
let is_debugging = matches.is_present("debugging");
|
||||||
|
let is_verbose = matches.is_present("verbosity");
|
||||||
|
|
||||||
|
Runtime::init_logger(is_debugging, is_verbose);
|
||||||
|
|
||||||
let rtp : PathBuf = matches.value_of("runtimepath")
|
let rtp : PathBuf = matches.value_of("runtimepath")
|
||||||
.map(PathBuf::from)
|
.map(PathBuf::from)
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or_else(|| {
|
||||||
|
@ -153,10 +159,10 @@ impl<'a> Runtime<'a> {
|
||||||
/**
|
/**
|
||||||
* Initialize the internal logger
|
* Initialize the internal logger
|
||||||
*/
|
*/
|
||||||
pub fn init_logger(&self) {
|
fn init_logger(is_debugging: bool, is_verbose: bool) {
|
||||||
let lvl = if self.is_debugging() {
|
let lvl = if is_debugging {
|
||||||
LogLevelFilter::Debug
|
LogLevelFilter::Debug
|
||||||
} else if self.is_verbose() {
|
} else if is_verbose {
|
||||||
LogLevelFilter::Info
|
LogLevelFilter::Info
|
||||||
} else {
|
} else {
|
||||||
LogLevelFilter::Error
|
LogLevelFilter::Error
|
||||||
|
|
Loading…
Reference in a new issue