aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Vander Stoep <jeffv@google.com>2024-01-29 13:25:09 +0100
committerJeff Vander Stoep <jeffv@google.com>2024-01-29 13:45:29 +0100
commit8328bd87a67c00e8224c1cbdb64c7044b3ec07a9 (patch)
tree0d07bc0a5fa8f8d91e11653083cdfebfe02be907
parentab8bc93c6c8ea92fb6ceb511333b7e803597c2aa (diff)
downloadandroid_logger-8328bd87a67c00e8224c1cbdb64c7044b3ec07a9.tar.gz
Provide with_log_buffer() function
The goal is to make it easier to update the 3p android_logger crate. This adds the upstream with_log_buffer() function. Android currently carries a local patch which provides the same functionality under a different name - with_log_id(). This is a temporary addition to allow updating individual parts of the platform to match the upstream crate to make the android_logger update more seemless. Normally we would update everything in one topic, but the number of changes is so large that this makes it simpler to get individual changes in. Bug: 322718401 Test: build and run CF with the change. Test: m aosp_cf_x86_64_phone Change-Id: Icc63571d640cad0a0580e574df56853288380442
-rw-r--r--src/lib.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index c2a3c08..b35db3f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -288,6 +288,17 @@ impl Config {
self
}
+ /// Changes the Android logging system buffer to be used.
+ ///
+ /// By default, logs are sent to the [`Main`] log. Other logging buffers may
+ /// only be accessible to certain processes.
+ ///
+ /// [`Main`]: LogId::Main
+ pub fn with_log_buffer(mut self, buf_id: LogId) -> Self {
+ self.log_id = Some(buf_id);
+ self
+ }
+
fn filter_matches(&self, record: &Record) -> bool {
if let Some(ref filter) = self.filter {
filter.matches(record)