From c837a9b0c6cf2dbf092a8931422bfa10a2f6a80d Mon Sep 17 00:00:00 2001 From: artemws <59208085+artemws@users.noreply.github.com> Date: Sun, 15 Feb 2026 10:12:33 +0200 Subject: [PATCH 1/2] Add disable_colors field to GeneralConfig Add option to disable colored output in logs --- src/config/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/config/mod.rs b/src/config/mod.rs index 98fcca7..ddaceee 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -164,6 +164,10 @@ pub struct GeneralConfig { #[serde(default)] pub log_level: LogLevel, + + /// Disable colored output in logs (useful for files/systemd) + #[serde(default)] + pub disable_colors: bool, } impl Default for GeneralConfig { @@ -179,6 +183,7 @@ impl Default for GeneralConfig { middle_proxy_nat_probe: false, middle_proxy_nat_stun: None, log_level: LogLevel::Normal, + disable_colors: false, } } } From 2a65d29e3b32e021f77f10de2da2f6e8227a5df2 Mon Sep 17 00:00:00 2001 From: artemws <59208085+artemws@users.noreply.github.com> Date: Sun, 15 Feb 2026 10:12:56 +0200 Subject: [PATCH 2/2] Configure color output based on user settings Added conditional color output configuration for logging. --- src/main.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index ad5b771..5d3d41c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -133,13 +133,24 @@ async fn main() -> std::result::Result<(), Box> { }; let (filter_layer, filter_handle) = reload::Layer::new(EnvFilter::new("info")); + + // Configure color output based on config + let fmt_layer = if config.general.disable_colors { + fmt::Layer::default().with_ansi(false) + } else { + fmt::Layer::default().with_ansi(true) + }; + tracing_subscriber::registry() .with(filter_layer) - .with(fmt::Layer::default()) + .with(fmt_layer) .init(); info!("Telemt MTProxy v{}", env!("CARGO_PKG_VERSION")); info!("Log level: {}", effective_log_level); + if config.general.disable_colors { + info!("Colors: disabled"); + } info!( "Modes: classic={} secure={} tls={}", config.general.modes.classic, config.general.modes.secure, config.general.modes.tls