You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't think that using JSON objects is the best choice for structured logging at all. In my opinion, JSON arrays are more suited:
They are easily parsed by JSON.parse and all major JSON toold as well
They are faster to parse
They are faster to stringify
They are more lightweight
I agree that the payload should be any object the user provides, but using objects for the root log record does not sound well for me.
Yes, the negative is that arrays are not as human readable as objects are, but with a first field specifying the schema version, it's just as machine readable.
And command-line filters using JSON agnostic tools (e.g. jq) should be just as easy as for objects.
Thus, if a unified standard would be crafted, I highly prefer arrays over objects; as I do use them within my logging library oddlog. And yes, I'm not sure how to include it within the readme because of the array-based log record format.
But since it's not used by any other library that I know of, I highly doubt that this would succeed 😿
The text was updated successfully, but these errors were encountered:
This schema would have the additional benefit of clear separation of the information sources (schema, process, logger, log). Even so the records are meant to be read by machines, they are easy to investigate by humans as well.
Hey there,
I don't think that using JSON objects is the best choice for structured logging at all. In my opinion, JSON arrays are more suited:
JSON.parse
and all major JSON toold as wellI agree that the payload should be any object the user provides, but using objects for the root log record does not sound well for me.
Yes, the negative is that arrays are not as human readable as objects are, but with a first field specifying the schema version, it's just as machine readable.
And command-line filters using JSON agnostic tools (e.g.
jq
) should be just as easy as for objects.Thus, if a unified standard would be crafted, I highly prefer arrays over objects; as I do use them within my logging library oddlog. And yes, I'm not sure how to include it within the readme because of the array-based log record format.
But since it's not used by any other library that I know of, I highly doubt that this would succeed 😿
The text was updated successfully, but these errors were encountered: