Skip to content

Commit

Permalink
restore the backward compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
tsionyx committed Dec 5, 2023
1 parent 86c903f commit 7ba8dee
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions sentry-tracing/src/converters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ impl Visit for FieldVisitor {
}

/// Creates a [`Breadcrumb`] from a given [`tracing_core::Event`]
pub fn breadcrumb_from_event<S>(event: &tracing_core::Event, _ctx: Option<Context<S>>) -> Breadcrumb
pub fn breadcrumb_from_event<'context, S>(
event: &tracing_core::Event,
_ctx: impl Into<Option<Context<'context, S>>>,
) -> Breadcrumb
where
S: Subscriber + for<'a> LookupSpan<'a>,
{
Expand Down Expand Up @@ -220,11 +223,14 @@ fn contexts_from_event(
}

/// Creates an [`Event`] from a given [`tracing_core::Event`]
pub fn event_from_event<S>(event: &tracing_core::Event, ctx: Option<Context<S>>) -> Event<'static>
pub fn event_from_event<'context, S>(
event: &tracing_core::Event,
ctx: impl Into<Option<Context<'context, S>>>,
) -> Event<'static>
where
S: Subscriber + for<'a> LookupSpan<'a>,
{
let (message, mut visitor) = extract_event_data(event, ctx);
let (message, mut visitor) = extract_event_data(event, ctx.into());

Event {
logger: Some(event.metadata().target().to_owned()),
Expand All @@ -237,9 +243,9 @@ where
}

/// Creates an exception [`Event`] from a given [`tracing_core::Event`]
pub fn exception_from_event<S>(
pub fn exception_from_event<'context, S>(
event: &tracing_core::Event,
ctx: Option<Context<S>>,
ctx: impl Into<Option<Context<'context, S>>>,
) -> Event<'static>
where
S: Subscriber + for<'a> LookupSpan<'a>,
Expand All @@ -248,7 +254,7 @@ where
// proper grouping and issue metadata generation. tracing_core::Record does not contain sufficient
// information for this. However, it may contain a serialized error which we can parse to emit
// an exception record.
let (mut message, visitor) = extract_event_data(event, ctx);
let (mut message, visitor) = extract_event_data(event, ctx.into());
let FieldVisitor {
mut exceptions,
mut json_values,
Expand Down

0 comments on commit 7ba8dee

Please sign in to comment.