Bug 1817900 - Update android_logger to 0.11.3. r=emilio,supply-chain-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D170421
This commit is contained in:
Mike Hommey 2023-02-23 01:00:54 +00:00
parent 98ea9b2281
commit a09e6438f5
6 changed files with 72 additions and 15 deletions

6
Cargo.lock generated
View File

@ -66,12 +66,12 @@ checksum = "85965b6739a430150bdd138e2374a98af0c3ee0d030b3bb7fc3bddff58d0102e"
[[package]]
name = "android_logger"
version = "0.11.1"
version = "0.11.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5e9dd62f37dea550caf48c77591dc50bd1a378ce08855be1a0c42a97b7550fb"
checksum = "8619b80c242aa7bd638b5c7ddd952addeecb71f69c75e33f1d47b2804f8f883a"
dependencies = [
"android_log-sys",
"env_logger 0.9.999",
"env_logger 0.10.0",
"log",
"once_cell",
]

View File

@ -29,6 +29,11 @@ criteria = "safe-to-deploy"
delta = "0.11.0 -> 0.11.1"
notes = "Small crate, wrapping Android log functionality, now switched to properly using MaybeUninit"
[[audits.android_logger]]
who = "Mike Hommey <mh+mozilla@glandium.org>"
criteria = "safe-to-deploy"
delta = "0.11.1 -> 0.11.3"
[[audits.android_system_properties]]
who = "Nicolas Silva <nical@fastmail.com>"
criteria = "safe-to-deploy"

View File

@ -1 +1 @@
{"files":{"Cargo.toml":"abdac5f9f4574b24d387e1a7d6e44cfd0d1bf9a95ebd858f51dc02bf5604c582","LICENSE-APACHE":"99938c5864dd33decb62ab20fd883a9b00181d768ae887a4f19b2d0015c41dc9","LICENSE-MIT":"35043211d1b7be8f7e3f9cad27d981f2189ba9a39d9527b275b3c9740298dfe2","README.md":"bf2e6227790edeb5959c2be250b71d1a197a3a344dc5fc1638fbb39c73bdfd21","src/lib.rs":"b789a29f5f55ccdc2ba9428747a39ce2a649e0c35ac30c983b0fa6c5f549e855","tests/config_log_level.rs":"dbe26e82c497031f47804ed59dfcdb5d09af7354591f90ea89b46315e7d2edc9","tests/default_init.rs":"e5c77dbcf3dc2d9e21e5c48c190e6cdcdea7d8eecea8c8ce513ca98223c46b49","tests/multiple_init.rs":"42adfe70b2f951a3b3f051235709013124df613a7967ca5bad998fc5356b8b9f"},"package":"b5e9dd62f37dea550caf48c77591dc50bd1a378ce08855be1a0c42a97b7550fb"}
{"files":{"CHANGELOG.md":"bed2dedbff30c278a6f8de0e014a5fb4538b74b711dc733d62199cab0b4c84aa","Cargo.toml":"b4200b3217cac7b6ce6947913e45f8886456a4aca19aa7e7a28b317d11d36e6f","LICENSE-APACHE":"99938c5864dd33decb62ab20fd883a9b00181d768ae887a4f19b2d0015c41dc9","LICENSE-MIT":"35043211d1b7be8f7e3f9cad27d981f2189ba9a39d9527b275b3c9740298dfe2","README.md":"bf2e6227790edeb5959c2be250b71d1a197a3a344dc5fc1638fbb39c73bdfd21","src/lib.rs":"bcee83b2bd47d8b795a7aca2bc354a4463a13068cbfe92918ddc76c93861e5f5","tests/config_log_level.rs":"dbe26e82c497031f47804ed59dfcdb5d09af7354591f90ea89b46315e7d2edc9","tests/default_init.rs":"e5c77dbcf3dc2d9e21e5c48c190e6cdcdea7d8eecea8c8ce513ca98223c46b49","tests/multiple_init.rs":"42adfe70b2f951a3b3f051235709013124df613a7967ca5bad998fc5356b8b9f"},"package":"8619b80c242aa7bd638b5c7ddd952addeecb71f69c75e33f1d47b2804f8f883a"}

View File

@ -0,0 +1,32 @@
`android_logger` changelog
==========================
All user visible changes to this project will be documented in this file. This project uses [Semantic Versioning 2.0.0].
## [0.11.3] · 2022-12-20
[0.11.3]: /../../tree/v0.11.3
[Diff](/../../compare/38186ece1056d90b8f75fd2a5eb5c860e0a1704e...v0.11.3)
### Fixed
- Broken compilation on [Android] targets. ([#59], [#58])
[#58]: /../../issues/58
[#59]: /../../pull/59
## Previous releases
See [Git log](/../../commits/master?after=1a5a07ec6742f0069acc2be223c1bb3b6a9d15f8+0).
[Android]: https://www.android.com
[Semantic Versioning 2.0.0]: https://semver.org

View File

@ -11,7 +11,7 @@
[package]
name = "android_logger"
version = "0.11.1"
version = "0.11.3"
authors = ["The android_logger Developers"]
description = """
A logging implementation for `log` which hooks to android log output.
@ -31,7 +31,7 @@ repository = "https://github.com/Nercury/android_logger-rs"
version = "0.2"
[dependencies.env_logger]
version = "0.9"
version = "0.10"
default-features = false
[dependencies.log]

View File

@ -113,6 +113,10 @@ impl AndroidLogger {
config: OnceCell::from(config),
}
}
fn config(&self) -> &Config {
self.config.get_or_init(Config::default)
}
}
static ANDROID_LOGGER: OnceCell<AndroidLogger> = OnceCell::new();
@ -130,13 +134,21 @@ impl Default for AndroidLogger {
}
impl Log for AndroidLogger {
fn enabled(&self, _: &Metadata) -> bool {
true
fn enabled(&self, metadata: &Metadata) -> bool {
let config = self.config();
// todo: consider __android_log_is_loggable.
Some(metadata.level()) >= config.log_level
}
fn log(&self, record: &Record) {
let config = self.config.get_or_init(Config::default);
let config = self.config();
if !self.enabled(record.metadata()) {
return;
}
// this also checks the level, but only if a filter was
// installed.
if !config.filter_matches(record) {
return;
}
@ -267,21 +279,29 @@ pub struct PlatformLogWriter<'a> {
impl<'a> PlatformLogWriter<'a> {
#[cfg(target_os = "android")]
pub fn new(level: Level, tag: &CStr) -> PlatformLogWriter {
pub fn new_with_priority(priority: log_ffi::LogPriority, tag: &CStr) -> PlatformLogWriter {
#[allow(deprecated)] // created an issue #35 for this
PlatformLogWriter {
priority: match level {
priority,
len: 0,
last_newline_index: 0,
tag,
buffer: uninit_array(),
}
}
#[cfg(target_os = "android")]
pub fn new(level: Level, tag: &CStr) -> PlatformLogWriter {
Self::new_with_priority(
match level {
Level::Warn => LogPriority::WARN,
Level::Info => LogPriority::INFO,
Level::Debug => LogPriority::DEBUG,
Level::Error => LogPriority::ERROR,
Level::Trace => LogPriority::VERBOSE,
},
len: 0,
last_newline_index: 0,
tag,
buffer: uninit_array(),
}
)
}
#[cfg(not(target_os = "android"))]