diff --git a/src/currentprocess.rs b/src/currentprocess.rs index af3b2548c3a..4523e4e6f85 100644 --- a/src/currentprocess.rs +++ b/src/currentprocess.rs @@ -32,8 +32,6 @@ use cwdsource::*; use filesource::*; use varsource::*; -use crate::currentprocess; - /// An abstraction for the current process. /// /// This acts as a clonable proxy to the global state provided by some key OS @@ -138,8 +136,6 @@ pub fn with(process: Process, f: F) -> R where F: FnOnce() -> R, { - use tracing_subscriber::util::SubscriberInitExt; - ensure_hook(); PROCESS.with(|p| { @@ -147,7 +143,6 @@ where panic!("current process already set {old_p:?}"); } *p.borrow_mut() = Some(process); - let _guard = tracing_subscriber().set_default(); let result = f(); *p.borrow_mut() = None; result @@ -164,35 +159,6 @@ fn ensure_hook() { }); } -fn tracing_subscriber() -> impl tracing::Subscriber { - use tracing_subscriber::{ - filter::{EnvFilter, LevelFilter}, - layer::SubscriberExt, - Layer, Registry, - }; - - let curr_process = currentprocess::process(); - let maybe_directives = curr_process.var_os("RUST_LOG").clone(); - let logger = tracing_subscriber::fmt::layer() - .with_writer(move || curr_process.stderr()) - .with_ansi(false); - let console_logger = if let Some(directives) = maybe_directives { - let env_filter = EnvFilter::builder() - .with_default_directive(LevelFilter::INFO.into()) - .parse_lossy(directives.to_string_lossy()); - logger.compact().with_filter(env_filter).boxed() - } else { - // Receive log lines from Rustup only. - let env_filter = EnvFilter::new("rustup=DEBUG"); - logger - .event_format(crate::cli::log::EventFormatter) - .with_filter(env_filter) - .boxed() - }; - // TODO: What about the original otel logger? - Registry::default().with(console_logger) -} - /// Run a function in the context of a process definition and a tokio runtime. /// /// The process state is injected into a thread-local in every work thread of @@ -203,8 +169,6 @@ pub fn with_runtime<'a, R>( mut runtime_builder: tokio::runtime::Builder, fut: impl Future + 'a, ) -> R { - use tracing::instrument::WithSubscriber; - ensure_hook(); let start_process = process.clone(); @@ -251,7 +215,7 @@ pub fn with_runtime<'a, R>( panic!("current process already set {old_p:?}"); } *p.borrow_mut() = Some(process); - let result = runtime.block_on(fut.with_subscriber(tracing_subscriber())); + let result = runtime.block_on(fut); *p.borrow_mut() = None; result })