diff --git a/.sampo/changesets/cli-colors-not-escaped.md b/.sampo/changesets/cli-colors-not-escaped.md new file mode 100644 index 00000000..69a7e6e6 --- /dev/null +++ b/.sampo/changesets/cli-colors-not-escaped.md @@ -0,0 +1,5 @@ +--- +cargo/maudit-cli: patch +--- + +Fixed the CLI printing raw escape codes (`\x1b[1m`) instead of colored text. diff --git a/crates/maudit-cli/src/logging.rs b/crates/maudit-cli/src/logging.rs index 2cfc5e5b..44434ef6 100644 --- a/crates/maudit-cli/src/logging.rs +++ b/crates/maudit-cli/src/logging.rs @@ -130,7 +130,10 @@ where } pub fn init_logging() { - let tracing_formatter = tracing_subscriber::fmt::layer().event_format(EventLoggerFormatter); + // We colorize our own messages, so tracing-subscriber must not escape their ANSI sequences. + let tracing_formatter = tracing_subscriber::fmt::layer() + .with_ansi_sanitization(false) + .event_format(EventLoggerFormatter); tracing_subscriber::registry() .with(