Skip to content

Commit

Permalink
tracing: Format field values with Display
Browse files Browse the repository at this point in the history
This removes the surrounding double quotes from logged field values.
  • Loading branch information
str4d committed Aug 11, 2020
1 parent d1e0087 commit f54f9d5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/rust/src/tracing_ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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)
)
)),
)
Expand Down Expand Up @@ -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(
Expand All @@ -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)
)
)),
)
Expand Down

0 comments on commit f54f9d5

Please sign in to comment.