diff --git a/Cargo.toml b/Cargo.toml index f0bd885..09a1b72 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "android_logger" -version = "0.13.3" +version = "0.14.0" authors = ["The android_logger Developers"] license = "MIT OR Apache-2.0" readme = "README.md" @@ -17,9 +17,7 @@ default = ["regex"] regex = ["env_filter/regex"] [dependencies] -once_cell = "1.9" env_filter = "0.1.0" -env_logger = "0.11.2" [dependencies.log] version = "0.4" diff --git a/src/lib.rs b/src/lib.rs index ee7e8be..1403ccd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -65,7 +65,6 @@ #[cfg(target_os = "android")] extern crate android_log_sys as log_ffi; -use once_cell::sync::OnceCell; use log::{Level, LevelFilter, Log, Metadata, Record}; #[cfg(target_os = "android")] @@ -74,9 +73,9 @@ use std::ffi::{CStr, CString}; use std::fmt; use std::mem::{self, MaybeUninit}; use std::ptr; +use std::sync::OnceLock; pub use env_filter::{Builder as FilterBuilder, Filter}; -pub use env_logger::fmt::Formatter; pub(crate) type FormatFn = Box fmt::Result + Sync + Send>; @@ -162,14 +161,14 @@ fn android_log(_buf_id: Option, _priority: Level, _tag: &CStr, _msg: &CSt /// Underlying android logger backend pub struct AndroidLogger { - config: OnceCell, + config: OnceLock, } impl AndroidLogger { /// Create new logger instance from config pub fn new(config: Config) -> AndroidLogger { AndroidLogger { - config: OnceCell::from(config), + config: OnceLock::from(config), } } @@ -178,7 +177,7 @@ impl AndroidLogger { } } -static ANDROID_LOGGER: OnceCell = OnceCell::new(); +static ANDROID_LOGGER: OnceLock = OnceLock::new(); const LOGGING_TAG_MAX_LEN: usize = 23; const LOGGING_MSG_MAX_LEN: usize = 4000; @@ -187,7 +186,7 @@ impl Default for AndroidLogger { /// Create a new logger with default config fn default() -> AndroidLogger { AndroidLogger { - config: OnceCell::from(Config::default()), + config: OnceLock::from(Config::default()), } } }