From 2f1ac7557b28f0c312fd9c55126d203dd36e16da Mon Sep 17 00:00:00 2001 From: Jeremy Steward Date: Fri, 23 May 2025 12:00:03 -0600 Subject: [PATCH] Make Writer::with_ansi public --- tracing-subscriber/src/fmt/format/mod.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tracing-subscriber/src/fmt/format/mod.rs b/tracing-subscriber/src/fmt/format/mod.rs index 6ea1891bc5..3700ac6add 100644 --- a/tracing-subscriber/src/fmt/format/mod.rs +++ b/tracing-subscriber/src/fmt/format/mod.rs @@ -441,8 +441,12 @@ impl<'writer> Writer<'writer> { } } - // TODO(eliza): consider making this a public API? - pub(crate) fn with_ansi(self, is_ansi: bool) -> Self { + /// Returns a new `Writer` with `is_ansi` set. + /// + /// If false, the returned `Writer` will not support ANSI escape code + /// output when written to by e.g. [`FormatEvent::format_event`] by a layer + /// that has ANSI escape codes enabled. + pub fn with_ansi(self, is_ansi: bool) -> Self { Self { is_ansi, ..self } }