Closed athirn closed 7 years ago
Flattening the message
into the top-level JSON object gives rise to name collisions with the other items already present in the JSON object. For example, if your log message is a Ruby Hash and one of the keys in that hash is named :level
, then it will conflict with the log level already present in the JSON object.
Two possible approaches for resolving these conflicts are:
The first solution loses information. That is not an acceptable trade off. The second solution alters the output of the log message in an unexpected fashion. Now you have to "know" that your field is going to be renamed because it conflicts with another field present in the top-level.
I'm good at dichotomies - is there another solution that I'm missing to disambiguate naming collisions without losing information? Thoughts? :thought_balloon:
Right now when I pass a ruby object to the logger, it gets serialized inside the message field. The result is nested JSON.
there should be a way to add fields into the top level JSON
{"timestamp":"2016-12-16T10:55:15.327794-05:00","level":"INFO","logger":"data","one":1,"two":2}