Skip to content
This repository was archived by the owner on Aug 1, 2024. It is now read-only.
This repository was archived by the owner on Aug 1, 2024. It is now read-only.

Bug: color_eyre interference with tracing in some cases #110

@lroux-at-jellysmack

Description

@lroux-at-jellysmack

Hello, I've been using color_eyre on a work project, and had experienced troubles with the logging (using tracing/tracing_subscriber).

What happening and what should happen ?

Observed Behavior: Creating a eyre::Report before initializing the tracing_subscriber even if we're ignoring it makes subsequent logs disappear.
Expected Behavior: The logs should still be printed, wether or not a eyre::Report is created.

Why is this issue on color_eyre and not on tracing_subscriber ?

While testing and trying to know what was happening, I switched to stable_eyre, and the issue fixed itself, so this must come from color_eyre.

Here is a minimal reproduction of the bug:

fn main() {
    // Initialize the `color_eyre` Handler
    color_eyre::install().unwrap();

    // If any [`eyre::Report`] is created (not even returned) at any point before
    // the initialization of the `tracing_subscriber`, the tracing logs never output
    let _ = color_eyre::eyre::eyre!("A very ignorable error, so we ignore it");
    // ^ If we were to comment this line, the log would appear

    // Initialize the `tracing_subscriber` Subscriber
    tracing_subscriber::fmt::init();

    tracing::info!("This log never appears in the console");
}

and I'm using the following versions of crates in my Cargo.toml:

[dependencies]
tracing = "0.1.35"
tracing-subscriber = "0.3.11"
color-eyre = "0.6.1"

Don't hesitate to ask any question :)
Thanks !

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions