From 7dfa26324dacf92596c6b27a56e4c768dd6582b2 Mon Sep 17 00:00:00 2001 From: rami3l Date: Sun, 2 Jun 2024 20:29:55 +0800 Subject: [PATCH] fixup! fixup! fixup! fixup! fixup! fixup! refactor(log): reimplement `log` using `tracing` --- src/test.rs | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/src/test.rs b/src/test.rs index 7b21d89e9d4..007284d6cf4 100644 --- a/src/test.rs +++ b/src/test.rs @@ -239,16 +239,13 @@ type Tracer = (); /// A tracer for the tests. pub(crate) static TRACER: Lazy = Lazy::new(|| { - use tracing_subscriber::Registry; - #[cfg(feature = "otel")] { - use crate::cli::log::{telemetry, telemetry_default_tracer}; + use crate::cli::log::telemetry_default_tracer; use opentelemetry::global; use opentelemetry_sdk::propagation::TraceContextPropagator; use tokio::runtime::Handle; - use tracing_subscriber::layer::SubscriberExt as _; // Use the current runtime, or the sync test runtime otherwise. let handle = match Handle::try_current() { @@ -259,16 +256,7 @@ pub(crate) static TRACER: Lazy = Lazy::new(|| { let _guard = handle.enter(); global::set_text_map_propagator(TraceContextPropagator::new()); - let tracer = telemetry_default_tracer().unwrap(); - let telemetry = telemetry(tracer.clone()); - let subscriber = Registry::default().with(telemetry); - tracing::subscriber::set_global_default(subscriber).unwrap(); - tracer - } - #[cfg(not(feature = "otel"))] - { - let subscriber = Registry::default(); - tracing::subscriber::set_global_default(subscriber).unwrap(); + telemetry_default_tracer().unwrap() } });