Skip to content

SubscriberBuilder::with_ansi is incorrectly gated by the ansi feature in tracing-subscriber 0.3.18 #2996

@eric-seppanen

Description

@eric-seppanen

Bug Report

Version

tracing v0.1.40
tracing-subscriber v0.3.18

Platform

Linux 6.2.0-39-generic #40~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Nov 16 10:53:04 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Crates

tracing-subscriber

Description

The tracing-subscriber 0.3.18 docs claim that SubscriberBuilder::with_ansi() can be used even when the ansi feature is disabled. And indeed this is true on master. But in the released 0.3.18 code this is not true: commit 049ad73 did not remove the #[cfg(feature = "ansi")] from the method.

The 0.3.18 version of the code is here:

/// This method itself is still available without the feature flag. This
/// is to allow ANSI escape codes to be explicitly *disabled* without
/// having to opt-in to the dependencies required to emit ANSI formatting.
/// This way, code which constructs a formatter that should never emit
/// ANSI escape codes can ensure that they are not used, regardless of
/// whether or not other crates in the dependency graph enable the "ansi"
/// feature flag.
#[cfg(feature = "ansi")]
#[cfg_attr(docsrs, doc(cfg(feature = "ansi")))]
pub fn with_ansi(self, ansi: bool) -> SubscriberBuilder<N, format::Format<L, T>, F, W> {
SubscriberBuilder {
inner: self.inner.with_ansi(ansi),
..self
}
}

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