LLDB has a quite extensive logging framework that is mostly used to help with bug reporting where users
are usually requested to attach the generated logs after reproducing a bug locally.
Right now all logging is done in plain text where usually one line in the text file equals one log message (but
that is more of a guideline, there are multi-line log messages too).
While the plain text logs are easy to read without any tools, they are often also really limiting the usefulness
of LLDB's logging framework:
- The plain text logs become hard to read when they are filled out with too much information (e.g., the automatic
bactrace option was enabled). This usually means we have to pick between a readable log or one that contains
more information.
- We can't easily write tools that make viewing logs easier. Writing a parser that extracts the different parts of a
log message from the plain text format is rather difficult.
This patch adds the log channel option to write the log message in JSON format. Every log message is now a
serialized JSON object that is just appended to the log file. For convenience I also added a trailing comma
behind every JSON object so that a log file can always be turned into a single top-level JSON object by just
surrounding it with [] and removing the last comma (for strict parsers that care about this).
The current plain text format is still available and the default. log enable -O json ... can be used to change
the channel format to JSON.
You at least need "the format", but maybe
configuring the format with which log messages are emitted and the metainformation which should...
is a little easier to parse.