From 20efe437fbca26a00a2030e5e0d55f3265b13d38 Mon Sep 17 00:00:00 2001 From: strawberry Date: Sun, 14 Apr 2024 19:12:39 -0400 Subject: [PATCH] default to debug log level if using debug build Signed-off-by: strawberry --- conduwuit-example.toml | 5 ++++- src/config/mod.rs | 9 ++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/conduwuit-example.toml b/conduwuit-example.toml index 65a0985d..c46fbadf 100644 --- a/conduwuit-example.toml +++ b/conduwuit-example.toml @@ -270,7 +270,10 @@ allow_profile_lookup_federation_requests = true # max log level for conduwuit. allows debug, info, warn, or error # see also: https://docs.rs/tracing-subscriber/latest/tracing_subscriber/filter/struct.EnvFilter.html#directives -# For release builds, the maximum log level for conduwuit is info. For debug builds, it is "trace". +# **Caveat**: +# For release builds, the tracing crate is configured to only implement levels higher than error to avoid unnecessary overhead in the compiled binary from trace macros. +# For debug builds, this restriction is not applied. +# # Defaults to "warn" #log = "warn" diff --git a/src/config/mod.rs b/src/config/mod.rs index 38171f62..047c5ca5 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -860,7 +860,14 @@ fn default_max_fetch_prev_events() -> u16 { 100_u16 } fn default_trusted_servers() -> Vec { vec![OwnedServerName::try_from("matrix.org").unwrap()] } -fn default_log() -> String { "warn,state_res=warn".to_owned() } +fn default_log() -> String { + // do debug logging by default for debug builds + if cfg!(debug_assertions) { + "debug".to_owned() + } else { + "warn,ruma_state_res=warn".to_owned() + } +} fn default_notification_push_path() -> String { "/_matrix/push/v1/notify".to_owned() }