From 038b0dc8d0641aad8e5a98cae0cda4b0e424e4e6 Mon Sep 17 00:00:00 2001 From: "Evgeniy A. Dushistov" Date: Sat, 15 Jun 2024 12:24:41 +0300 Subject: [PATCH 1/3] remove once_cell as dependency our MSVR at least 1.71.0, and once_cell was merge into std in 1.70.0, so there are no reason to use external one instead of std --- Cargo.toml | 1 - src/lib.rs | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f0bd885..97369a9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,6 @@ default = ["regex"] regex = ["env_filter/regex"] [dependencies] -once_cell = "1.9" env_filter = "0.1.0" env_logger = "0.11.2" diff --git a/src/lib.rs b/src/lib.rs index ee7e8be..29f84bb 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,6 +73,7 @@ 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; @@ -162,14 +162,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 +178,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 +187,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()), } } } From 18f1e462b3d81c5ddddba96c03b4dd88ca52f9f3 Mon Sep 17 00:00:00 2001 From: "Evgeniy A. Dushistov" Date: Sat, 15 Jun 2024 15:44:21 +0300 Subject: [PATCH 2/3] Don't see reason to depend on env_logger just for reexport --- Cargo.toml | 1 - src/lib.rs | 1 - 2 files changed, 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 97369a9..d2e6eaa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,7 +18,6 @@ regex = ["env_filter/regex"] [dependencies] 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 29f84bb..1403ccd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -76,7 +76,6 @@ 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>; From e5f0e39a1826557e142d87af1cb1eba9d3efe00a Mon Sep 17 00:00:00 2001 From: "Evgeniy A. Dushistov" Date: Sat, 15 Jun 2024 12:30:49 +0300 Subject: [PATCH 3/3] version bump because of major dependency update increment our version number --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index d2e6eaa..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"