Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

refactor: disable color in reports in json format (#2509)

Chethan Raoaa176c7c5d79
diff --git a/Cargo.lock b/Cargo.lock
index 83dd8c4f1f..b8290efee0 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -4179,6 +4179,7 @@ version = "0.1.0"
dependencies = [
"cargo_metadata 0.15.4",
"config",
+ "error-stack",
"gethostname",
"once_cell",
"opentelemetry",
diff --git a/crates/router_env/Cargo.toml b/crates/router_env/Cargo.toml
index c72220f52d..1181685d72 100644
--- a/crates/router_env/Cargo.toml
+++ b/crates/router_env/Cargo.toml
@@ -10,6 +10,7 @@ license.workspace = true
[dependencies]
cargo_metadata = "0.15.4"
config = { version = "0.13.3", features = ["toml"] }
+error-stack = "0.3.1"
gethostname = "0.4.3"
once_cell = "1.18.0"
opentelemetry = { version = "0.19.0", features = ["rt-tokio-current-thread", "metrics"] }
diff --git a/crates/router_env/src/logger/setup.rs b/crates/router_env/src/logger/setup.rs
index 313e64d0e9..78cbe9f342 100644
--- a/crates/router_env/src/logger/setup.rs
+++ b/crates/router_env/src/logger/setup.rs
@@ -101,6 +101,7 @@ pub fn setup(
subscriber.with(logging_layer).init();
}
config::LogFormat::Json => {
+ error_stack::Report::set_color_mode(error_stack::fmt::ColorMode::None);
let logging_layer =
FormattingLayer::new(service_name, console_writer).with_filter(console_filter);
subscriber.with(logging_layer).init();