Skip to content

Commit

Permalink
feat(api): populate Metadata's field names (console-rs#32)
Browse files Browse the repository at this point in the history
In console-rs#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 <zaharidichev@gmail.com>
  • Loading branch information
zaharidichev committed May 27, 2021
1 parent 94aad1c commit e45fca0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion console-api/src/common.rs
Expand Up @@ -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()
}
}
Expand Down

0 comments on commit e45fca0

Please sign in to comment.