From 3b94aae0d76975548331f962b8dfbabf4210e716 Mon Sep 17 00:00:00 2001 From: Iulian Moraru Date: Tue, 23 Jan 2024 22:20:15 +0200 Subject: [PATCH] Backed out changeset bba5c678e394 (bug 1874215) for causing xpchsell failures on test_register_app_services_logger.js. CLOSED TREE --- services/common/app_services_logger/src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/services/common/app_services_logger/src/lib.rs b/services/common/app_services_logger/src/lib.rs index 92125b62c4baa..0ad96a782a210 100644 --- a/services/common/app_services_logger/src/lib.rs +++ b/services/common/app_services_logger/src/lib.rs @@ -11,11 +11,13 @@ extern crate cstr; extern crate xpcom; use golden_gate::log::LogSink; +use log; use nserror::{nsresult, NS_OK}; use nsstring::nsAString; use once_cell::sync::Lazy; use std::os::raw::c_char; use std::{ + cmp, collections::HashMap, sync::{ atomic::{AtomicBool, Ordering}, @@ -44,6 +46,11 @@ impl AppServicesLogger { xpcom_method!(register => Register(target: *const nsAString, logger: *const mozIServicesLogSink)); fn register(&self, target: &nsAString, logger: &mozIServicesLogSink) -> Result<(), nsresult> { let log_sink_logger = LogSink::with_logger(Some(logger))?; + let max_level = cmp::max(log::max_level(), log_sink_logger.max_level); + + // Note: This will only work if the max_level is lower than the compile-time + // max_level_* filter. + log::set_max_level(max_level); ensure_observing_shutdown();