Replace use of deprecated logging functions
This is needed to upgrade the android_logger crate from 0.12.0
to 0.13.3.
with_max_level provides the same functionality as with_min_level.
The renaming is admittedly confusing, but the new name is accurate
and it makes sense that they deprecated and then removed the
previously poorly named with_min_level.
See crate documentation [1] and code [2].
[1]: https://docs.rs/android_logger/0.12.0/android_logger/struct.Config.html#method.with_min_level
[2]: https://docs.rs/android_logger/0.12.0/src/android_logger/lib.rs.html#227
Bug: 322718401
Test: build and run CF with the change.
Test: m aosp_cf_x86_64_phone
Change-Id: I39532792c2efd8a20a25da23004bc335d6c8ad7f
diff --git a/virtualizationservice/src/main.rs b/virtualizationservice/src/main.rs
index ea073bf..ad21e89 100644
--- a/virtualizationservice/src/main.rs
+++ b/virtualizationservice/src/main.rs
@@ -27,7 +27,7 @@
use android_system_virtualizationservice_internal::aidl::android::system::virtualizationservice_internal::IVirtualizationServiceInternal::BnVirtualizationServiceInternal;
use anyhow::Error;
use binder::{register_lazy_service, BinderFeatures, ProcessState, ThreadState};
-use log::{info, Level};
+use log::{info, LevelFilter};
use std::fs::{create_dir, read_dir};
use std::os::unix::raw::{pid_t, uid_t};
use std::path::Path;
@@ -48,8 +48,8 @@
android_logger::init_once(
Config::default()
.with_tag(LOG_TAG)
- .with_min_level(Level::Info)
- .with_log_id(android_logger::LogId::System)
+ .with_max_level(LevelFilter::Info)
+ .with_log_buffer(android_logger::LogId::System)
.with_filter(
// Reduce logspam by silencing logs from the disk crate which don't provide much
// information to us.
diff --git a/virtualizationservice/vfio_handler/src/main.rs b/virtualizationservice/vfio_handler/src/main.rs
index 1a1cce8..318d134 100644
--- a/virtualizationservice/vfio_handler/src/main.rs
+++ b/virtualizationservice/vfio_handler/src/main.rs
@@ -24,7 +24,7 @@
IVfioHandler,
};
use binder::{register_lazy_service, BinderFeatures, ProcessState};
-use log::{info, Level};
+use log::{info, LevelFilter};
const LOG_TAG: &str = "VfioHandler";
@@ -32,8 +32,8 @@
android_logger::init_once(
Config::default()
.with_tag(LOG_TAG)
- .with_min_level(Level::Info)
- .with_log_id(android_logger::LogId::System),
+ .with_max_level(LevelFilter::Info)
+ .with_log_buffer(android_logger::LogId::System),
);
let service = VfioHandler::init();