DefaultPrintfMessageParser

Default implementation of the printf message parser. This parser supports all the place-holders available in String#format but can be extended, if desired, for additional behavior For consistency it is recommended, but not required, that custom printf parsers always extend from this class.

This class is immutable and thread safe (and any subclasses must also be so).

See also

<a href="https://github.com/google/flogger/blob/cb9e836a897d36a78309ee8badf5cad4e6a2d3d8/api/src/main/java/com/google/common/flogger/parser/DefaultPrintfMessageParser.java">

Original Java code of Google Flogger

Inherited properties

Link copied to clipboard
public final static int MAX_ARG_COUNT
The maximum allowed index (this should correspond to the MAX_ALLOWED_WIDTH in FormatOptions because at times it is ambiguous as to which is being parsed).

Functions

Link copied to clipboard
Link copied to clipboard
public int parsePrintfTerm(MessageBuilder<? extends Object> builder, int index, String message, int termStart, int specStart, int formatStart)
Parses a single printf-like term from a log message into a message template builder.

Inherited functions

Link copied to clipboard
protected final void parseImpl<T>(MessageBuilder<T> builder)
Abstract parse method implemented by specific subclasses to modify parsing behavior.
Link copied to clipboard
public final void unescape(StringBuilder out, String message, int start, int end)
Appends the unescaped literal representation of the given message string (assumed to be escaped according to this parser's escaping rules).