From 22c239c21282e1b206db5624fca23aaa02d873b6 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 19 Feb 2019 21:19:34 +0100 Subject: Add output about logger settings in logging setup This way we can get trace-level information about the logger itself when it is generated. Because from time to time we might want to have a look at that. Signed-off-by: Matthias Beyer --- lib/core/libimagrt/src/logger.rs | 3 +++ lib/core/libimagrt/src/runtime.rs | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/core/libimagrt') diff --git a/lib/core/libimagrt/src/logger.rs b/lib/core/libimagrt/src/logger.rs index fa6c8c28..585f2855 100644 --- a/lib/core/libimagrt/src/logger.rs +++ b/lib/core/libimagrt/src/logger.rs @@ -41,6 +41,7 @@ use libimagerror::errors::ErrorMsg as EM; type ModuleName = String; +#[derive(Debug)] enum LogDestination { Stderr, File(Arc>), @@ -52,6 +53,7 @@ impl Default for LogDestination { } } +#[derive(Debug)] struct ModuleSettings { enabled: bool, level: Option, @@ -61,6 +63,7 @@ struct ModuleSettings { } /// Logger implementation for `log` crate. +#[derive(Debug)] pub struct ImagLogger { global_loglevel : Level, diff --git a/lib/core/libimagrt/src/runtime.rs b/lib/core/libimagrt/src/runtime.rs index 4f2a485f..a5071745 100644 --- a/lib/core/libimagrt/src/runtime.rs +++ b/lib/core/libimagrt/src/runtime.rs @@ -367,11 +367,15 @@ impl<'a> Runtime<'a> { set_max_level(logger.global_loglevel().to_level_filter()); - debug!("Init logger with {}", logger.global_loglevel()); + // safe debug output for later, after the instance itself + // is moved away + let logger_expl = format!("{:?}", logger); set_boxed_logger(Box::new(logger)) .map_err(|e| panic!("Could not setup logger: {:?}", e)) .ok(); + + trace!("Imag Logger = {}", logger_expl); } } -- cgit v1.2.3