public abstract class LogMessage extends Object implements CharSequence
Supplier
instance (typically bound to a lambda
expression) or a printf-style format string (String.format(java.lang.String, java.lang.Object...)
) in its
toString()
.of(Supplier)
,
format(String, Object)
,
format(String, Object...)
,
Log.fatal(Object)
,
Log.error(Object)
,
Log.warn(Object)
,
Log.info(Object)
,
Log.debug(Object)
,
Log.trace(Object)
Constructor and Description |
---|
LogMessage() |
Modifier and Type | Method and Description |
---|---|
char |
charAt(int index) |
static LogMessage |
format(String format,
Object... args)
Build a lazily formatted message from the given format string and varargs.
|
static LogMessage |
format(String format,
Object arg1)
Build a lazily formatted message from the given format string and argument.
|
static LogMessage |
format(String format,
Object arg1,
Object arg2)
Build a lazily formatted message from the given format string and arguments.
|
static LogMessage |
format(String format,
Object arg1,
Object arg2,
Object arg3)
Build a lazily formatted message from the given format string and arguments.
|
static LogMessage |
format(String format,
Object arg1,
Object arg2,
Object arg3,
Object arg4)
Build a lazily formatted message from the given format string and arguments.
|
int |
length() |
static LogMessage |
of(Supplier<? extends CharSequence> supplier)
Build a lazily resolving message from the given supplier.
|
CharSequence |
subSequence(int start,
int end) |
String |
toString()
This will be called by the logging provider, potentially once
per log target (therefore locally caching the result here).
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
chars, codePoints
public int length()
length
in interface CharSequence
public char charAt(int index)
charAt
in interface CharSequence
public CharSequence subSequence(int start, int end)
subSequence
in interface CharSequence
public String toString()
toString
in interface CharSequence
toString
in class Object
public static LogMessage of(Supplier<? extends CharSequence> supplier)
supplier
- the supplier (typically bound to a lambda expression)toString()
public static LogMessage format(String format, @Nullable Object arg1)
format
- the format string (following String.format(java.lang.String, java.lang.Object...)
rules)arg1
- the argument (can be null
)String.format(String, Object...)
public static LogMessage format(String format, @Nullable Object arg1, @Nullable Object arg2)
format
- the format string (following String.format(java.lang.String, java.lang.Object...)
rules)arg1
- the first argument (can be null
)arg2
- the second argument (can be null
)String.format(String, Object...)
public static LogMessage format(String format, @Nullable Object arg1, @Nullable Object arg2, @Nullable Object arg3)
format
- the format string (following String.format(java.lang.String, java.lang.Object...)
rules)arg1
- the first argument (can be null
)arg2
- the second argument (can be null
)arg3
- the third argument (can be null
)String.format(String, Object...)
public static LogMessage format(String format, @Nullable Object arg1, @Nullable Object arg2, @Nullable Object arg3, @Nullable Object arg4)
format
- the format string (following String.format(java.lang.String, java.lang.Object...)
rules)arg1
- the first argument (can be null
)arg2
- the second argument (can be null
)arg3
- the third argument (can be null
)arg4
- the fourth argument (can be null
)String.format(String, Object...)
public static LogMessage format(String format, @Nullable Object... args)
This varargs format()
variant may be costly. You should therefore
use the individual argument variants whenever possible:
format(String, Object)
, format(String, Object, Object)
, etc.
format
- the format string (following String.format(java.lang.String, java.lang.Object...)
rules)args
- the varargs array (can be null
and can contain null
elements)String.format(String, Object...)