Logger init for tests
This commit is contained in:
+1
-1
@@ -35,7 +35,7 @@ extern crate serde_derive;
|
||||
|
||||
// Logging related
|
||||
pub mod logger;
|
||||
pub use logger::{LOGGER, init_logger};
|
||||
pub use logger::{LOGGER, init_logger, init_test_logger};
|
||||
|
||||
pub mod types;
|
||||
pub use types::LoggingConfig;
|
||||
|
||||
@@ -89,3 +89,15 @@ pub fn init_logger(config: Option<LoggingConfig>) {
|
||||
*was_init_ref = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// Initializes the logger for unit and integration tests
|
||||
pub fn init_test_logger() {
|
||||
let mut was_init_ref = WAS_INIT.lock().unwrap();
|
||||
if was_init_ref {
|
||||
return;
|
||||
}
|
||||
let mut config_ref = LOGGING_CONFIG.lock().unwrap();
|
||||
*config_ref = LoggingConfig::default();
|
||||
*was_init_ref = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user