tracing: Format field values with Display

This removes the surrounding double quotes from logged field values.
This commit is contained in:
Jack Grigg 2020-08-11 01:06:34 +01:00
parent d1e0087bd5
commit f54f9d5e06
1 changed files with 4 additions and 2 deletions

View File

@ -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)
)
)),
)