Skip to content

Commit

Permalink
Make tracing-subscriber mandatory
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed Apr 2, 2024
1 parent a52843a commit da2575a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 21 deletions.
11 changes: 4 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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"]

Expand Down Expand Up @@ -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"
Expand Down
24 changes: 10 additions & 14 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit da2575a

Please sign in to comment.