android13/system/logging/rust/tests/config_log_level.rs

17 lines
482 B
Rust
Raw Normal View History

2024-06-22 08:45:49 -04:00
use std::env;
#[test]
fn config_log_level() {
// Environment variables should be overwritten by config values.
env::set_var("RUST_LOG", "debug");
let init_result = logger::init(
logger::Config::default()
.with_min_level(log::Level::Trace));
assert!(init_result);
// Setting the level through the Config struct should impact both host and device
assert_eq!(log::max_level(), log::LevelFilter::Trace);
env::remove_var("RUST_LOG");
}