Skip to content

Commit 6568b7b

Browse files
fix(otel): keep piped stderr diagnostics plain — fmt layer ansi follows tty
tracing_subscriber's fmt layer enables ANSI whenever the 'ansi' feature is on, regardless of destination, so redirected stderr carried SGR escapes where the pre-migration eprintln! path emitted plain bytes. Gate the layer on std::io::stderr().is_terminal(). agent-identity: unknown agent-persona: generalist agent-supervisor: unavailable agent-tool: OMP agent-tool-version: 18.0.3 agent-runtime: OMP 18.0.3 tooling-profile: dotfiles@929dc21
1 parent 2e2a884 commit 6568b7b

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

src/telemetry.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
//! exports log records via an SDK logger provider. Logs emitted inside a span automatically
1313
//! carry its trace/span ids.
1414
15+
use std::io::IsTerminal as _;
1516
use std::sync::atomic::{AtomicBool, Ordering};
1617

1718
use opentelemetry::trace::{Span as _, Tracer as _};
@@ -291,6 +292,7 @@ fn install_subscriber<S>(
291292
)
292293
.with(
293294
tracing_subscriber::fmt::layer()
295+
.with_ansi(std::io::stderr().is_terminal())
294296
.with_writer(std::io::stderr)
295297
.with_filter(filter),
296298
),

0 commit comments

Comments
 (0)