Skip to content

Json/Structured Logs extras #563

Closed Answered by odygrd
JoshBurrell asked this question in Q&A
Discussion options

You must be logged in to vote

Hey, I don’t think it’s possible at the moment.

The key names are derived from the format string, so if a key is missing there, the value of the argument will be ignored.

The thread issuing the log passes only the format string and argument values to the backend thread, not a separate key-value map. The backend thread extracts the key names from the format string and maps them to their corresponding values.

We could still print the value without a key, it wouldn’t be very useful, but i am okay with it.

For example, if we add it positionally to a JSON output for total_score of 100 like this:

info("'{name}' scored {points}", name, points, total_score);

json :
{“name”: "Josh", “score”: 3, “2…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by JoshBurrell
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants