JSON Logging to the Console
Please add a new writer that supports JSON output to the console instead of a file.
There is an existing json writer, but it currently only supports writing out to a file.
One can simulate JSON output to the console using the console writer, but it is easy to run into some gotchas. Given the below tinylog.properties file...
writer = console
writer.level = info
writer.format = {opening-curly-bracket}"timestamp": "{date}", "level": "{level}", "message": "{message}", "thread": "{thread}"{closing-curly-bracket}
writer.charset = UTF-8
writer.stream = out
...notice the writer.format line. It simulates JSON, but it becomes invalid JSON if the message has multiple lines (e.g. \n) or a JSON-reserved character (e.g. "). This can easily happen if there is an exception's stacktrace being logged.
So, while one can accomplish a simple simulation of JSON console logging, I believe tinylog will benefit from adding a native JSON writer to the console that fully supports JSON.
This feature is already implemented in the branch of tinylog 3.
Oh, that's great to hear! I'm looking forward to version 3.
Here is a preview of the documentation of tinylog 3: https://github.com/tinylog-org/website/blob/v3/content/documentation/configuration.md#json