From f54f9d5e06c60918afc88d919913b4ce9fe78348 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Tue, 11 Aug 2020 01:06:34 +0100 Subject: [PATCH] tracing: Format field values with Display This removes the surrounding double quotes from logged field values. --- src/rust/src/tracing_ffi.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/rust/src/tracing_ffi.rs b/src/rust/src/tracing_ffi.rs index fb810ab09..f3eb9a15f 100644 --- a/src/rust/src/tracing_ffi.rs +++ b/src/rust/src/tracing_ffi.rs @@ -456,6 +456,7 @@ pub extern "C" fn tracing_span_create( .map(|&p| unsafe { CStr::from_ptr(p) }) .map(|cs| cs.to_string_lossy()); + use tracing::field::display; macro_rules! new_span { ($n:tt) => { Span::new( @@ -464,7 +465,7 @@ pub extern "C" fn tracing_span_create( $n, ( &fi.next().unwrap(), - Some(&vi.next().unwrap().as_ref() as &dyn Value) + Some(&display(vi.next().unwrap().as_ref()) as &dyn Value) ) )), ) @@ -562,6 +563,7 @@ pub extern "C" fn tracing_log( .map(|&p| unsafe { CStr::from_ptr(p) }) .map(|cs| cs.to_string_lossy()); + use tracing::field::display; macro_rules! dispatch { ($n:tt) => { Event::dispatch( @@ -570,7 +572,7 @@ pub extern "C" fn tracing_log( $n, ( &fi.next().unwrap(), - Some(&vi.next().unwrap().as_ref() as &dyn Value) + Some(&display(vi.next().unwrap().as_ref()) as &dyn Value) ) )), )