add tokio console
This commit is contained in:
Generated
+1
@@ -6617,6 +6617,7 @@ dependencies = [
|
||||
"chacha",
|
||||
"clap",
|
||||
"colored",
|
||||
"console-subscriber",
|
||||
"criterion",
|
||||
"csv",
|
||||
"cupid",
|
||||
|
||||
@@ -38,6 +38,7 @@ tracing-indicatif = { workspace = true }
|
||||
tracing-subscriber.workspace = true
|
||||
tokio = { workspace = true, features = ["macros", "sync", "rt-multi-thread"] }
|
||||
tokio-util = { workspace = true, features = ["codec"] }
|
||||
console-subscriber = { workspace = true, optional = true }
|
||||
toml = { workspace = true }
|
||||
url = { workspace = true, features = ["serde"] }
|
||||
zeroize = { workspace = true, features = ["zeroize_derive"] }
|
||||
@@ -123,6 +124,9 @@ harness = false
|
||||
# temporary bonding information v1 (to grab and parse nym-mixnode and nym-gateway package versions)
|
||||
cargo_metadata = { workspace = true }
|
||||
|
||||
[features]
|
||||
console = ["console-subscriber"]
|
||||
|
||||
[dev-dependencies]
|
||||
criterion = { workspace = true, features = ["async_tokio"] }
|
||||
rand_chacha = { workspace = true }
|
||||
|
||||
+15
-2
@@ -6,6 +6,9 @@ use tracing_subscriber::filter::Directive;
|
||||
use tracing_subscriber::layer::SubscriberExt;
|
||||
use tracing_subscriber::util::SubscriberInitExt;
|
||||
|
||||
#[cfg(feature = "console")]
|
||||
use console_subscriber;
|
||||
|
||||
pub(crate) fn granual_filtered_env() -> anyhow::Result<tracing_subscriber::filter::EnvFilter> {
|
||||
fn directive_checked(directive: impl Into<String>) -> anyhow::Result<Directive> {
|
||||
directive.into().parse().map_err(From::from)
|
||||
@@ -22,9 +25,19 @@ pub(crate) fn granual_filtered_env() -> anyhow::Result<tracing_subscriber::filte
|
||||
}
|
||||
|
||||
pub(crate) fn build_tracing_logger() -> anyhow::Result<impl SubscriberExt> {
|
||||
Ok(tracing_subscriber::registry()
|
||||
let registry = tracing_subscriber::registry()
|
||||
.with(default_tracing_fmt_layer(std::io::stderr))
|
||||
.with(granual_filtered_env()?))
|
||||
.with(granual_filtered_env()?);
|
||||
|
||||
#[cfg(feature = "console")]
|
||||
{
|
||||
Ok(registry.with(console_subscriber::spawn()))
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "console"))]
|
||||
{
|
||||
Ok(registry)
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn setup_tracing_logger() -> anyhow::Result<()> {
|
||||
|
||||
Reference in New Issue
Block a user