From e45fca08102cefec7494d28f80863990cfb24160 Mon Sep 17 00:00:00 2001 From: Zahari Dichev Date: Thu, 27 May 2021 21:36:20 +0300 Subject: [PATCH] feat(api): populate `Metadata`'s `field names` (#32) In #26 `field_names` field was introduced in the `Metadata` message but was never populated. This PR populates it with the names of the fields Signed-off-by: Zahari Dichev --- console-api/src/common.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/console-api/src/common.rs b/console-api/src/common.rs index a45988e6..7b5e6e24 100644 --- a/console-api/src/common.rs +++ b/console-api/src/common.rs @@ -39,13 +39,15 @@ impl<'a> From<&'a tracing_core::Metadata<'a>> for Metadata { column: None, // tracing doesn't support columns yet }; + let field_names = meta.fields().iter().map(|f| f.name().to_string()).collect(); + Metadata { name: meta.name().to_string(), target: meta.target().to_string(), location: Some(location), kind: kind as i32, level: metadata::Level::from(*meta.level()) as i32, - field_names: Vec::new(), + field_names, ..Default::default() } }