mirror of
https://github.com/girlbossceo/conduwuit.git
synced 2024-12-04 20:08:10 +00:00
add config option to disable ANSI log colours
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
3e65ae1cbe
commit
518a83676e
|
@ -373,6 +373,11 @@ allow_profile_lookup_federation_requests = true
|
||||||
# Defaults to "info"
|
# Defaults to "info"
|
||||||
#log = "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)
|
# controls whether encrypted rooms and events are allowed (default true)
|
||||||
#allow_encryption = false
|
#allow_encryption = false
|
||||||
|
|
||||||
|
|
|
@ -185,6 +185,8 @@ pub struct Config {
|
||||||
pub query_trusted_key_servers_first: bool,
|
pub query_trusted_key_servers_first: bool,
|
||||||
#[serde(default = "default_log")]
|
#[serde(default = "default_log")]
|
||||||
pub log: String,
|
pub log: String,
|
||||||
|
#[serde(default = "true_fn", alias = "log_colours")]
|
||||||
|
pub log_colors: bool,
|
||||||
#[serde(default = "default_openid_token_ttl")]
|
#[serde(default = "default_openid_token_ttl")]
|
||||||
pub openid_token_ttl: u64,
|
pub openid_token_ttl: u64,
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
|
|
|
@ -18,7 +18,7 @@ pub(crate) fn init(config: &Config) -> Result<(LogLevelReloadHandles, TracingFla
|
||||||
let reload_handles = LogLevelReloadHandles::default();
|
let reload_handles = LogLevelReloadHandles::default();
|
||||||
|
|
||||||
let console_filter = EnvFilter::try_new(&config.log).map_err(|e| err!(Config("log", "{e}.")))?;
|
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());
|
let (console_reload_filter, console_reload_handle) = reload::Layer::new(console_filter.clone());
|
||||||
reload_handles.add("console", Box::new(console_reload_handle));
|
reload_handles.add("console", Box::new(console_reload_handle));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue