Skip to content

Commit

Permalink
Add the closing } to the JSON logs
Browse files Browse the repository at this point in the history
The map was not correctly ended.
  • Loading branch information
Julius de Bruijn committed Nov 5, 2019
1 parent e53df80 commit 2a0de64
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tracing-subscriber/src/fmt/format/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ where
serializer.serialize_entry("target", meta.target())?;
}

serializer.serialize_entry("fields", &event.field_map())
serializer.serialize_entry("fields", &event.field_map())?;
serializer.end()
};

visit().map_err(|_| fmt::Error)?;
Expand Down Expand Up @@ -264,7 +265,7 @@ mod test {
let make_writer = || MockWriter::new(&BUF);

let expected =
"{\"timestamp\":\"fake time\",\"level\":\"INFO\",\"span\":{\"name\":\"json_span\",\"fields\":\"{\\\"answer\\\":42,\\\"number\\\":3}\"},\"target\":\"tracing_subscriber::fmt::format::json::test\",\"fields\":{\"message\":\"some json test\"}\n";
"{\"timestamp\":\"fake time\",\"level\":\"INFO\",\"span\":{\"name\":\"json_span\",\"fields\":\"{\\\"answer\\\":42,\\\"number\\\":3}\"},\"target\":\"tracing_subscriber::fmt::format::json::test\",\"fields\":{\"message\":\"some json test\"}}\n";

test_json(make_writer, expected, &BUF);
}
Expand Down

0 comments on commit 2a0de64

Please sign in to comment.