public abstract class LogMessage
extends java.lang.Object
implements java.lang.CharSequence
Supplier
instance
(typically bound to a Java 8 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)
Modifier and Type | Class and Description |
---|---|
private static class |
LogMessage.FormatMessage |
private static class |
LogMessage.FormatMessage1 |
private static class |
LogMessage.FormatMessage2 |
private static class |
LogMessage.FormatMessage3 |
private static class |
LogMessage.FormatMessage4 |
private static class |
LogMessage.FormatMessageX |
private static class |
LogMessage.SupplierMessage |
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
result |
Constructor and Description |
---|
LogMessage() |
Modifier and Type | Method and Description |
---|---|
(package private) abstract java.lang.String |
buildString() |
char |
charAt(int index) |
static LogMessage |
format(java.lang.String format,
java.lang.Object... args)
Build a lazily formatted message from the given format string and varargs.
|
static LogMessage |
format(java.lang.String format,
java.lang.Object arg1)
Build a lazily formatted message from the given format string and argument.
|
static LogMessage |
format(java.lang.String format,
java.lang.Object arg1,
java.lang.Object arg2)
Build a lazily formatted message from the given format string and arguments.
|
static LogMessage |
format(java.lang.String format,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3)
Build a lazily formatted message from the given format string and arguments.
|
static LogMessage |
format(java.lang.String format,
java.lang.Object arg1,
java.lang.Object arg2,
java.lang.Object arg3,
java.lang.Object arg4)
Build a lazily formatted message from the given format string and arguments.
|
int |
length() |
static LogMessage |
of(java.util.function.Supplier<? extends java.lang.CharSequence> supplier)
Build a lazily resolving message from the given supplier.
|
java.lang.CharSequence |
subSequence(int start,
int end) |
java.lang.String |
toString()
This will be called by the logging provider, potentially once
per log target (therefore locally caching the result here).
|
@Nullable private java.lang.String result
public int length()
length
in interface java.lang.CharSequence
public char charAt(int index)
charAt
in interface java.lang.CharSequence
public java.lang.CharSequence subSequence(int start, int end)
subSequence
in interface java.lang.CharSequence
public java.lang.String toString()
toString
in interface java.lang.CharSequence
toString
in class java.lang.Object
abstract java.lang.String buildString()
public static LogMessage of(java.util.function.Supplier<? extends java.lang.CharSequence> supplier)
supplier
- the supplier (typically bound to a Java 8 lambda expression)toString()
public static LogMessage format(java.lang.String format, java.lang.Object arg1)
format
- the format string (following String.format(java.lang.String, java.lang.Object...)
rules)arg1
- the argumentString.format(String, Object...)
public static LogMessage format(java.lang.String format, java.lang.Object arg1, java.lang.Object arg2)
format
- the format string (following String.format(java.lang.String, java.lang.Object...)
rules)arg1
- the first argumentarg2
- the second argumentString.format(String, Object...)
public static LogMessage format(java.lang.String format, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3)
format
- the format string (following String.format(java.lang.String, java.lang.Object...)
rules)arg1
- the first argumentarg2
- the second argumentarg3
- the third argumentString.format(String, Object...)
public static LogMessage format(java.lang.String format, java.lang.Object arg1, java.lang.Object arg2, java.lang.Object arg3, java.lang.Object arg4)
format
- the format string (following String.format(java.lang.String, java.lang.Object...)
rules)arg1
- the first argumentarg2
- the second argumentarg3
- the third argumentarg4
- the fourth argumentString.format(String, Object...)
public static LogMessage format(java.lang.String format, java.lang.Object... args)
format
- the format string (following String.format(java.lang.String, java.lang.Object...)
rules)args
- the varargs array (costly, prefer individual arguments)String.format(String, Object...)