Skip to content
This repository was archived by the owner on May 12, 2026. It is now read-only.

Enable making tracing-subscriber an optional dependency#18

Open
kate-goldenring wants to merge 1 commit into
spinframework:mainfrom
kate-goldenring:optional-tracing-subscriber
Open

Enable making tracing-subscriber an optional dependency#18
kate-goldenring wants to merge 1 commit into
spinframework:mainfrom
kate-goldenring:optional-tracing-subscriber

Conversation

@kate-goldenring
Copy link
Copy Markdown
Contributor

@kate-goldenring kate-goldenring commented Mar 28, 2024

The tracing-subscriber crate enables the tracing-log feature which will set up a global logger and panic if one already exists. If this project is consumed as a library a subscriber and logger may already exist and should not be reinitialized.

Where the tracing-log feature enables recreating a global logger: https://github.com/tokio-rs/tracing/blob/908cc432a5994f6e17c8f36e13c217dc40085704/tracing-subscriber/src/util.rs#L65

The tracing-subscriber crate enables the tracing-log feature which
will set up a global logger and panic if one already exists. If this
project is consumed as a library a subscriber and logger may already
exist and should not be reinitialized.

Signed-off-by: Kate Goldenring <kate.goldenring@fermyon.com>
Comment thread src/main.rs
@@ -1,5 +1,5 @@

use clap::Parser;
#[cfg(feature = "tracing-subscriber")]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternatively you can probably remove this dependency and use std::io::IsTerminal

Copy link
Copy Markdown
Contributor

@calebschoepp calebschoepp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as well. Let's hold off on merging this though. It turns out we may still need to switch from logging to tracing in runwasi which would make this obsolete.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants