I'm currently using JSON for my logging. The logger produces output like this:
{"severity":"INFO","datetime":"2021-09-03 09:48:17 UTC","file_line":4,"message":"hello\nworld","progname":""}
These json logs can be formatted like so, which is more readable:
{
"severity": "INFO",
"datetime": "2021-09-03 09:51:13 UTC",
"file_line": 7,
"message": "hello\nworld",
"progname": ""
}
However, I have a lot of long multiline message strings, and this becomes difficult to read because there are no newlines allowed inside JSON strings - see this stackoverflow answer: Are multi-line strings allowed in JSON?
My question: is there a way to get around this? If not, is there a logging format which is the best of both worlds - easy for a machine to parse, but also easy for a human to read (supports multiline strings)?