Skip to content

Regression: New tracing-subscriber breaks ANSI color and styling support #3369

@ziemkowski

Description

@ziemkowski

Bug Report

The 0.3.20 release with PR #3368 attempts to disallow unsafe ANSI control characters, but escaping the ESC character disables all ANSI control sequences, making coloring and styling in logs now show escaped ANSI sequences.

It seems like the ANSI escape sequence character (\x1b ESC) should not be included in the list, as it also controls when colors and styles are honored.

If the desire is to escape all ANSI, could we change format().with_ansi() to something like format().with_dangerous_ansi() and disable the entire #3368 change?

Version

tracing v0.1.41 (*)
tracing-subscriber v0.3.20 (*)

Platform

Darwin adrian-personal 24.6.0 Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:55 PDT 2025; root:xnu-11417.140.69~1/RELEASE_ARM64_T6031 arm64

Crates

tracing-subscriber

Description

I have hundreds (thousands?) of instances of colored-rs vars in my logs that now print escape sequences in color TTYs.

For example:

info!("This is red: {}", "color test".red());

now escapes the color sequence despite format().with_ansi(use_color):

This is red: \x1b[31mcolor test\x1b[0m

The PR description mentions "while preserving the ability for applications to deliberately include formatting in trusted contexts" but I didn't see a way to do this. If there is in fact a way, it should be better documented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions