single-source for defaulty log filter string

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-05-31 05:39:51 +00:00
parent 102bd1b4a6
commit 7d2f510cc3
2 changed files with 4 additions and 2 deletions

View file

@ -975,7 +975,8 @@ fn default_tracing_flame_output_path() -> String { "./tracing.folded".to_owned()
fn default_trusted_servers() -> Vec<OwnedServerName> { vec![OwnedServerName::try_from("matrix.org").unwrap()] }
fn default_log() -> String {
#[must_use]
pub fn default_log() -> String {
// do debug logging by default for debug builds
if cfg!(debug_assertions) {
"debug".to_owned()

View file

@ -1,6 +1,7 @@
use std::sync::Arc;
use conduit::{
config,
config::Config,
info,
log::{LogLevelReloadHandles, ReloadHandle},
@ -103,7 +104,7 @@ fn init_tracing(config: &Config) -> (LogLevelReloadHandles, TracingFlameGuard) {
Ok(s) => s,
Err(e) => {
eprintln!("It looks like your config is invalid. The following error occured while parsing it: {e}");
EnvFilter::try_new("warn").unwrap()
EnvFilter::try_new(config::default_log()).expect("failed to set default EnvFilter")
},
};