类 LogMessage
- java.lang.Object
- org.springframework.core.log.LogMessage
- 所有已实现的接口:
CharSequence
public abstract class LogMessage extends Object implements CharSequence
A simple log message type for use with Commons Logging, allowing for convenient lazy resolution of a givenSupplier
instance (typically bound to a Java 8 lambda expression) or a printf-style format string (String.format(java.lang.String, java.lang.Object...)
) in itstoString()
.- 从以下版本开始:
- 5.2
- 作者:
- Juergen Hoeller
- 另请参阅:
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)
构造器概要
构造器 构造器 说明 LogMessage()
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 char
charAt(int index)
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... args)
Build a lazily formatted message from the given format string and varargs.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).从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
从接口继承的方法 java.lang.CharSequence
chars, codePoints
构造器详细资料
LogMessage
public LogMessage()
方法详细资料
length
public int length()
- 指定者:
length
在接口中CharSequence
charAt
public char charAt(int index)
- 指定者:
charAt
在接口中CharSequence
subSequence
public CharSequence subSequence(int start, int end)
- 指定者:
subSequence
在接口中CharSequence
toString
public String toString()
This will be called by the logging provider, potentially once per log target (therefore locally caching the result here).- 指定者:
toString
在接口中CharSequence
- 覆盖:
toString
在类中Object
of
public static LogMessage of(Supplier<? extends CharSequence> supplier)
Build a lazily resolving message from the given supplier.- 参数:
supplier
- the supplier (typically bound to a Java 8 lambda expression)- 另请参阅:
toString()
format
public static LogMessage format(String format, Object arg1)
Build a lazily formatted message from the given format string and argument.- 参数:
format
- the format string (followingString.format(java.lang.String, java.lang.Object...)
rules)arg1
- the argument- 另请参阅:
String.format(String, Object...)
format
public static LogMessage format(String format, Object arg1, Object arg2)
Build a lazily formatted message from the given format string and arguments.- 参数:
format
- the format string (followingString.format(java.lang.String, java.lang.Object...)
rules)arg1
- the first argumentarg2
- the second argument- 另请参阅:
String.format(String, Object...)
format
public static LogMessage format(String format, Object arg1, Object arg2, Object arg3)
Build a lazily formatted message from the given format string and arguments.- 参数:
format
- the format string (followingString.format(java.lang.String, java.lang.Object...)
rules)arg1
- the first argumentarg2
- the second argumentarg3
- the third argument- 另请参阅:
String.format(String, Object...)
format
public 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.- 参数:
format
- the format string (followingString.format(java.lang.String, java.lang.Object...)
rules)arg1
- the first argumentarg2
- the second argumentarg3
- the third argumentarg4
- the fourth argument- 另请参阅:
String.format(String, Object...)
format
public static LogMessage format(String format, Object... args)
Build a lazily formatted message from the given format string and varargs.- 参数:
format
- the format string (followingString.format(java.lang.String, java.lang.Object...)
rules)args
- the varargs array (costly, prefer individual arguments)- 另请参阅:
String.format(String, Object...)