fix default capture EnvFilter in release mode

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-08-31 11:45:36 +00:00
parent 7b852352e5
commit 14b9511d2e
2 changed files with 16 additions and 3 deletions

View File

@ -15,7 +15,7 @@ use conduit::{
},
trace,
utils::string::{collect_stream, common_prefix},
Error, Result,
warn, Error, Result,
};
use futures_util::future::FutureExt;
use ruma::{
@ -114,7 +114,15 @@ async fn process(context: &Command<'_>, command: AdminCommand, args: &[String])
fn capture_create(context: &Command<'_>) -> (Arc<Capture>, Arc<Mutex<String>>) {
let env_config = &context.services.server.config.admin_log_capture;
let env_filter = EnvFilter::try_new(env_config).unwrap_or_else(|_| "debug".into());
let env_filter = EnvFilter::try_new(env_config).unwrap_or_else(|e| {
warn!("admin_log_capture filter invalid: {e:?}");
cfg!(debug_assertions)
.then_some("debug")
.or(Some("info"))
.map(Into::into)
.expect("default capture EnvFilter")
});
let log_level = env_filter
.max_level_hint()
.and_then(LevelFilter::into_level)

View File

@ -1079,6 +1079,11 @@ fn default_sentry_filter() -> String { "info".to_owned() }
fn default_startup_netburst_keep() -> i64 { 50 }
fn default_admin_log_capture() -> String { "debug".to_owned() }
fn default_admin_log_capture() -> String {
cfg!(debug_assertions)
.then_some("debug")
.unwrap_or("info")
.to_owned()
}
fn default_admin_room_tag() -> String { "m.server_notice".to_owned() }