diff --git a/tracing-tracy/Cargo.toml b/tracing-tracy/Cargo.toml index 2346706..2723e04 100644 --- a/tracing-tracy/Cargo.toml +++ b/tracing-tracy/Cargo.toml @@ -17,7 +17,7 @@ harness = false [dependencies] tracing-core = { version = "0.1", default-features = false, features = ["std"] } -tracing-subscriber = { version = "0.2", default-features = false, features = ["fmt", "registry"] } +tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt", "registry"] } tracy-client = { path = "../tracy-client", version = "0.12.1", default-features = false } [dev-dependencies] diff --git a/tracing-tracy/src/lib.rs b/tracing-tracy/src/lib.rs index d448b2e..3e6f2d0 100644 --- a/tracing-tracy/src/lib.rs +++ b/tracing-tracy/src/lib.rs @@ -135,13 +135,13 @@ where S: Subscriber + for<'a> registry::LookupSpan<'a>, F: for<'writer> FormatFields<'writer> + 'static, { - fn new_span(&self, attrs: &Attributes<'_>, id: &Id, ctx: Context<'_, S>) { + fn on_new_span(&self, attrs: &Attributes<'_>, id: &Id, ctx: Context<'_, S>) { if let Some(span) = ctx.span(id) { let mut extensions = span.extensions_mut(); if extensions.get_mut::>().is_none() { - let mut buf = String::with_capacity(64); - if self.fmt.format_fields(&mut buf, attrs).is_ok() { - extensions.insert(FormattedFields::::new(buf)); + let mut fields = FormattedFields::::new(String::with_capacity(64)); + if self.fmt.format_fields(fields.as_writer(), attrs).is_ok() { + extensions.insert(fields); } } } @@ -149,13 +149,13 @@ where fn on_record(&self, id: &Id, values: &Record<'_>, ctx: Context<'_, S>) { if let Some(span) = ctx.span(id) { - let mut exts = span.extensions_mut(); - if let Some(FormattedFields { fields, .. }) = exts.get_mut::>() { + let mut extensions = span.extensions_mut(); + if let Some(fields) = extensions.get_mut::>() { let _ = self.fmt.add_fields(fields, values); } else { - let mut buf = String::with_capacity(64); - if self.fmt.format_fields(&mut buf, values).is_ok() { - exts.insert(FormattedFields::::new(buf)); + let mut fields = FormattedFields::::new(String::with_capacity(64)); + if self.fmt.format_fields(fields.as_writer(), values).is_ok() { + extensions.insert(fields); } } } @@ -181,7 +181,7 @@ where Span::new( self.truncate_to_length( &name, - &file, + file, "", "span information is too long and was truncated", ),