postage/logging.rs
1#![allow(dead_code)]
2
3#[cfg(feature = "debug")]
4pub use debug_impl::*;
5
6#[cfg(feature = "debug")]
7mod debug_impl {
8 use log::LevelFilter;
9 use std::sync::Once;
10
11 static LOG: Once = Once::new();
12
13 pub fn enable_log() {
14 LOG.call_once(|| {
15 simple_logger::SimpleLogger::new()
16 .with_level(LevelFilter::Info)
17 .init()
18 .unwrap();
19 });
20 }
21}
22
23#[cfg(not(feature = "debug"))]
24pub fn enable_log() {}