From 904d3fa8c0ede3172d7a188f3fde61d1936ba5d1 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 27 Oct 2015 00:01:11 +0100 Subject: [PATCH] Pass configuration from cfg file to Runtime as well --- src/main.rs | 2 +- src/runtime.rs | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index c17a3fe0..ffce2d4a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,7 +21,7 @@ fn main() { let configuration = Configuration::new(&config); let logger = ImagLogger::init(&configuration, &config); - let rt = Runtime::new(config); + let rt = Runtime::new(configuration, config); info!("Hello, world!"); } diff --git a/src/runtime.rs b/src/runtime.rs index b7f8c40c..f781181a 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -59,22 +59,24 @@ impl log::Log for ImagLogger { pub struct Runtime<'a> { pub config : Config<'a>, + pub configuration : Cfg, } impl<'a> Runtime<'a> { - pub fn new(config : Config<'a>) -> Runtime<'a> { + pub fn new(cfg: Cfg, config : Config<'a>) -> Runtime<'a> { Runtime { config: config, + configuration: cfg, } } pub fn is_verbose(&self) -> bool { - self.config.is_verbose() + self.config.is_verbose() || self.configuration.is_verbose() } pub fn is_debugging(&self) -> bool { - self.config.is_debugging() + self.config.is_debugging() || self.configuration.is_verbose() } }