Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! fixup! fixup! refactor(log): reimplement …
Browse files Browse the repository at this point in the history
…`log` using `tracing`
  • Loading branch information
rami3l committed Jun 2, 2024
1 parent 653f8cc commit 7dfa263
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,16 +239,13 @@ type Tracer = ();

/// A tracer for the tests.
pub(crate) static TRACER: Lazy<Tracer> = 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() {
Expand All @@ -259,16 +256,7 @@ pub(crate) static TRACER: Lazy<Tracer> = 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()
}
});

Expand Down

0 comments on commit 7dfa263

Please sign in to comment.