Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion server/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::io::IsTerminal;
use std::net::SocketAddr;

use opentelemetry::trace::TracerProvider as _;
Expand Down Expand Up @@ -58,7 +59,15 @@ async fn main() -> anyhow::Result<()> {
EnvFilter::try_from_default_env()
.unwrap_or_else(|_| EnvFilter::new("info,watcher_server=debug,sqlx=warn")),
)
.with(tracing_subscriber::fmt::layer())
// Only colorize when stdout is a real terminal. Under Kubernetes (and any
// piped/redirected stdout) the fmt layer's default ANSI-on would otherwise
// litter the pod logs with raw `\x1b[..m` escape sequences. `NO_COLOR`
// (https://no-color.org) force-disables it regardless.
.with(
tracing_subscriber::fmt::layer().with_ansi(
std::io::stdout().is_terminal() && std::env::var_os("NO_COLOR").is_none(),
),
)
.with(otel_layer)
.init();

Expand Down