From da2575a93d7e9d1a00adf03b6ffbf37ac814c8bf Mon Sep 17 00:00:00 2001 From: messense Date: Tue, 2 Apr 2024 20:37:58 +0800 Subject: [PATCH] Make `tracing-subscriber` mandatory --- Cargo.toml | 11 ++++------- src/main.rs | 24 ++++++++++-------------- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8c48c20ce..53ef92610 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -101,9 +101,7 @@ cargo-xwin = { version = "0.16.4", default-features = false, optional = true } # log tracing = "0.1.36" -tracing-subscriber = { version = "0.3.15", features = [ - "env-filter", -], optional = true } +tracing-subscriber = { version = "0.3.15", features = ["env-filter"] } # project scaffolding, maturin new/init/generate-ci dialoguer = { version = "0.11.0", default-features = false, optional = true } @@ -146,9 +144,7 @@ which = "6.0.0" [features] default = ["full", "rustls"] -full = ["cli-completion", "cross-compile", "log", "scaffolding", "upload"] - -log = ["tracing-subscriber"] +full = ["cli-completion", "cross-compile", "scaffolding", "upload"] cli-completion = ["dep:clap_complete_command"] @@ -191,8 +187,9 @@ scaffolding = ["dialoguer", "console", "minijinja", "unicode-xid"] # Internal feature to speed up the tests significantly faster-tests = [] -# Deprecated features, keep it now for compatibility +# Deprecated features, keep them now for compatibility human-panic = [] +log = [] [profile.profiling] inherits = "release" diff --git a/src/main.rs b/src/main.rs index 1ed357905..a5aae5df2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -23,7 +23,6 @@ use maturin::{upload_ui, PublishOpt}; use std::env; use std::path::PathBuf; use tracing::{debug, instrument}; -#[cfg(feature = "log")] use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt}; #[derive(Debug, Parser)] @@ -464,20 +463,17 @@ fn main() { #[cfg(not(debug_assertions))] setup_panic_hook(); - #[cfg(feature = "log")] - { - let logger = tracing_subscriber::fmt::layer() - // Avoid showing all the details from the spans - .compact() - // Log the timing of each span - .with_span_events(tracing_subscriber::fmt::format::FmtSpan::CLOSE); + let logger = tracing_subscriber::fmt::layer() + // Avoid showing all the details from the spans + .compact() + // Log the timing of each span + .with_span_events(tracing_subscriber::fmt::format::FmtSpan::CLOSE); - tracing_subscriber::registry() - // `RUST_LOG` support - .with(tracing_subscriber::EnvFilter::from_default_env()) - .with(logger) - .init(); - } + tracing_subscriber::registry() + // `RUST_LOG` support + .with(tracing_subscriber::EnvFilter::from_default_env()) + .with(logger) + .init(); if let Err(e) = run() { eprintln!("💥 maturin failed");