Skip to content

Commit

Permalink
single-source for defaulty log filter string
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Volk <[email protected]>
  • Loading branch information
jevolk committed Jun 2, 2024
1 parent 780325a commit b16fd66
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/core/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion src/main/server.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::sync::Arc;

use conduit::{
config,
config::Config,
info,
log::{LogLevelReloadHandles, ReloadHandle},
Expand Down Expand Up @@ -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")
},
};

Expand Down

0 comments on commit b16fd66

Please sign in to comment.