diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2016-03-26 16:23:59 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2016-03-26 16:23:59 +0100 |
commit | 64e0841a8f9bb5ebd7eb1f021dc711a501c925ba (patch) | |
tree | e04427488e9e0884274042a862b001b7670a9841 /libimagrt | |
parent | 06af6b3303b8391e1826a42e6f048de1d477d4bf (diff) | |
parent | d6aa42bd60aefbacebc21a80132abcd544638f6b (diff) |
Merge pull request #292 from matthiasbeyer/libimagrt/create-logger-on-runtime-setup
Move logger initialization to earliest possible point
Diffstat (limited to 'libimagrt')
-rw-r--r-- | libimagrt/src/runtime.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/libimagrt/src/runtime.rs b/libimagrt/src/runtime.rs index d401940e..746bf100 100644 --- a/libimagrt/src/runtime.rs +++ b/libimagrt/src/runtime.rs @@ -39,6 +39,12 @@ impl<'a> Runtime<'a> { use configuration::error::ConfigErrorKind; 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") .map(PathBuf::from) .unwrap_or_else(|| { @@ -153,10 +159,10 @@ impl<'a> Runtime<'a> { /** * Initialize the internal logger */ - pub fn init_logger(&self) { - let lvl = if self.is_debugging() { + fn init_logger(is_debugging: bool, is_verbose: bool) { + let lvl = if is_debugging { LogLevelFilter::Debug - } else if self.is_verbose() { + } else if is_verbose { LogLevelFilter::Info } else { LogLevelFilter::Error |