diff --git a/conduwuit-example.toml b/conduwuit-example.toml index 2792f792..6142705d 100644 --- a/conduwuit-example.toml +++ b/conduwuit-example.toml @@ -363,6 +363,11 @@ allow_profile_lookup_federation_requests = true # Defaults to "info" #log = "info" +# controls whether logs will be outputted with ANSI colours +# +# defaults to true +#log_colors = true + # controls whether encrypted rooms and events are allowed (default true) #allow_encryption = false diff --git a/src/core/config/mod.rs b/src/core/config/mod.rs index f48c78c9..bb520d06 100644 --- a/src/core/config/mod.rs +++ b/src/core/config/mod.rs @@ -184,6 +184,8 @@ pub struct Config { pub query_trusted_key_servers_first: bool, #[serde(default = "default_log")] pub log: String, + #[serde(default = "true_fn", alias = "log_colours")] + pub log_colors: bool, #[serde(default = "default_openid_token_ttl")] pub openid_token_ttl: u64, #[serde(default)] diff --git a/src/main/tracing.rs b/src/main/tracing.rs index 0217f38a..9b4ad659 100644 --- a/src/main/tracing.rs +++ b/src/main/tracing.rs @@ -18,7 +18,7 @@ pub(crate) fn init(config: &Config) -> Result<(LogLevelReloadHandles, TracingFla let reload_handles = LogLevelReloadHandles::default(); let console_filter = EnvFilter::try_new(&config.log).map_err(|e| err!(Config("log", "{e}.")))?; - let console_layer = tracing_subscriber::fmt::Layer::new(); + let console_layer = tracing_subscriber::fmt::Layer::new().with_ansi(config.log_colors); let (console_reload_filter, console_reload_handle) = reload::Layer::new(console_filter.clone()); reload_handles.add("console", Box::new(console_reload_handle));