diff --git a/src/lib.rs b/src/lib.rs index 1403ccd..54a36c8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -164,6 +164,11 @@ pub struct AndroidLogger { config: OnceLock, } +impl std::fmt::Debug for AndroidLogger { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("AndroidLogger").finish() + } +} impl AndroidLogger { /// Create new logger instance from config pub fn new(config: Config) -> AndroidLogger { diff --git a/tests/debug.rs b/tests/debug.rs new file mode 100644 index 0000000..c5642d8 --- /dev/null +++ b/tests/debug.rs @@ -0,0 +1,12 @@ +use android_logger::AndroidLogger; +use android_logger::Config; +use log::LevelFilter; +use std::sync::OnceLock; + +#[test] +fn test_debug() { + static ANDROID_LOGGER: OnceLock = OnceLock::new(); + let android_logger = ANDROID_LOGGER + .get_or_init(|| AndroidLogger::new(Config::default().with_max_level(LevelFilter::Trace))); + assert_eq!("AndroidLogger", format!("{:?}", android_logger)); +}