Closed gandarez closed 10 months ago
The json format for logs is used, as it is machine-readable. Now this issue is about having human-readability and machine-readability at the same time. This makes things more complicated, as it conflicts with the JSON rfc (https://greenbytes.de/tech/webdav/rfc8259.html):
An object is an unordered collection of zero or more name/value pairs, where a name is a string and a value is a string, number, boolean, null, object, or array.
An array is an ordered sequence of zero or more values.
We won't be able to achieve this behavior, if we stick to logrus. And even if we ditch logrus, it will only be possible with some custom logic using reflect
package.
Will move this to the backlog, as it needs further discussion about the effort/value of it.
Not worth changing as logs are readable enough as-is.
Marshaling in Golang produces fields in alphabetical order which is not the ideal in this scenario. The outputted log might follow the legacy implementantion.
https://golang.org/pkg/encoding/json/#Marshal
legacy
current