Key Value Formatter
Formats key/value pairs as a human readable string on the end of log statements. The format is:
Log Message PREFIX[ key1=value1 key2=value2 ]
Content copied to clipboard
Multi line
Log Message
PREFIX[ key1=value1 key2=value2 ]
Content copied to clipboard
- Key/value pairs are appended in the order they are handled.
- If no key/value pairs are handled, the log message is unchanged (no prefix is added).
- Keys can be repeated.
- Key labels do not need quoting.
- String-like values are properly quoted and escaped (e.g. \", \\, \n, \t)
- Unsafe control characters in string-like values are replaced by U+FFFD (�).
- All key/value pairs are on the "same line" of the log message.
See also
<a href="https://github. com/google/flogger/blob/cb9e836a897d36a78309ee8badf5cad4e6a2d3d8/api/src/main/java/com/google/common/flogger/backend/Key Value Formatter. java">
Original Java code of Google Flogger