1use once_cell::sync::Lazy;
2use std::fmt::Display;
3use std::env;
4use std::sync::Mutex;
5
6mod debugger;
7mod utils;
8
9pub mod debug_macro;
10
11pub use debugger::RsDebugger;
12
13static DEFAULT_LOGGER: Lazy<Mutex<RsDebugger>> = Lazy::new(|| {
15 let label = env::var("DEBUG_DEFAULT_LABEL").unwrap_or("debugrs:default".to_string());
16 Mutex::new(RsDebugger::new(label))
17});
18
19
20pub fn log<T: Display>(message: T) {
29 if let Ok(mut logger) = DEFAULT_LOGGER.lock() {
30 logger.write(message.to_string());
31 }
32}