diff --git a/CHANGELOG.md b/CHANGELOG.md index 8aaf007..4cd037b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # Changelog All notable changes to this project will be documented in this file. +## [Unreleased] +- Enabled ANSI formatting in the tracing formatter whenever stderr is attached to a terminal so colorized updater messages render correctly instead of showing escape sequences. ## [1.51.0] - Added diff-only Git scanning via `--since-commit` and `--branch`, including remote-aware ref resolution so CI jobs can pair `--git-url` clones with pull request branches diff --git a/src/main.rs b/src/main.rs index d44019f..89d9cf5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -27,7 +27,7 @@ static GLOBAL: System = System; // static GLOBAL: System = System; use std::{ - io::Read, + io::{IsTerminal, Read}, sync::{Arc, Mutex}, }; @@ -122,7 +122,7 @@ fn setup_logging(global_args: &GlobalArgs) { let fmt_layer = fmt::layer() .with_writer(std::io::stderr) // Write logs to stderr .with_target(true) // Enable target filtering - .with_ansi(false) // Disable colors + .with_ansi(std::io::stderr().is_terminal()) // Emit ANSI colours when stderr is a TTY .without_time(); // Remove timestamps // Build and initialize the registry registry()