public static class LogConfiguration.Builder
extends java.lang.Object
LogConfiguration.| Constructor and Description |
|---|
Builder()
Construct a builder with all default configurations.
|
Builder(LogConfiguration logConfiguration)
Construct a builder with all configurations from another
LogConfiguration. |
| Modifier and Type | Method and Description |
|---|---|
LogConfiguration.Builder |
addInterceptor(Interceptor interceptor)
Add an interceptor.
|
<T> LogConfiguration.Builder |
addObjectFormatter(java.lang.Class<T> objectClass,
ObjectFormatter<? super T> objectFormatter)
Add a
ObjectFormatter for specific class of object. |
LogConfiguration.Builder |
b()
Enable border.
|
LogConfiguration.Builder |
borderFormatter(BorderFormatter borderFormatter)
Set the border formatter used when logging.
|
LogConfiguration |
build()
Builds configured
LogConfiguration object. |
LogConfiguration.Builder |
jsonFormatter(JsonFormatter jsonFormatter)
Set the JSON formatter used when log a JSON string.
|
LogConfiguration.Builder |
logLevel(int logLevel)
Set the log level, the logs below of which would not be printed.
|
LogConfiguration.Builder |
nb()
Disable border.
|
LogConfiguration.Builder |
nst()
Disable stack trace.
|
LogConfiguration.Builder |
nt()
Disable thread info.
|
LogConfiguration.Builder |
st(int depth)
Enable stack trace.
|
LogConfiguration.Builder |
st(java.lang.String stackTraceOrigin,
int depth)
Enable stack trace.
|
LogConfiguration.Builder |
stackTraceFormatter(StackTraceFormatter stackTraceFormatter)
Set the stack trace formatter used when logging.
|
LogConfiguration.Builder |
t()
Enable thread info.
|
LogConfiguration.Builder |
tag(java.lang.String tag)
Set the tag string used when log.
|
LogConfiguration.Builder |
threadFormatter(ThreadFormatter threadFormatter)
Set the thread formatter used when logging.
|
LogConfiguration.Builder |
throwableFormatter(ThrowableFormatter throwableFormatter)
Set the throwable formatter used when log a message with throwable.
|
LogConfiguration.Builder |
xmlFormatter(XmlFormatter xmlFormatter)
Set the XML formatter used when log a XML string.
|
public Builder()
public Builder(LogConfiguration logConfiguration)
LogConfiguration.logConfiguration - the LogConfiguration to copy configurations frompublic LogConfiguration.Builder logLevel(int logLevel)
logLevel - the log levelpublic LogConfiguration.Builder tag(java.lang.String tag)
tag - the tag string used when logpublic LogConfiguration.Builder t()
public LogConfiguration.Builder nt()
public LogConfiguration.Builder st(int depth)
depth - the number of stack trace elements we should log, 0 if no limitationpublic LogConfiguration.Builder st(java.lang.String stackTraceOrigin, int depth)
stackTraceOrigin - the origin of stack trace elements from which we should NOT log when
logging with stack trace, it can be a package name like
"com.elvishew.xlog", a class name like "com.yourdomain.logWrapper",
or something else between package name and class name, like "com.yourdomain.".
It is mostly used when you are using a logger wrapperdepth - the number of stack trace elements we should log, 0 if no limitationpublic LogConfiguration.Builder nst()
public LogConfiguration.Builder b()
public LogConfiguration.Builder nb()
public LogConfiguration.Builder jsonFormatter(JsonFormatter jsonFormatter)
jsonFormatter - the JSON formatter used when log a JSON stringpublic LogConfiguration.Builder xmlFormatter(XmlFormatter xmlFormatter)
xmlFormatter - the XML formatter used when log a XML stringpublic LogConfiguration.Builder throwableFormatter(ThrowableFormatter throwableFormatter)
throwableFormatter - the throwable formatter used when log a message with throwablepublic LogConfiguration.Builder threadFormatter(ThreadFormatter threadFormatter)
threadFormatter - the thread formatter used when loggingpublic LogConfiguration.Builder stackTraceFormatter(StackTraceFormatter stackTraceFormatter)
stackTraceFormatter - the stack trace formatter used when loggingpublic LogConfiguration.Builder borderFormatter(BorderFormatter borderFormatter)
borderFormatter - the border formatter used when loggingpublic <T> LogConfiguration.Builder addObjectFormatter(java.lang.Class<T> objectClass, ObjectFormatter<? super T> objectFormatter)
ObjectFormatter for specific class of object.T - the type of objectobjectClass - the class of objectobjectFormatter - the object formatter to addpublic LogConfiguration.Builder addInterceptor(Interceptor interceptor)
interceptor - the interceptor to addpublic LogConfiguration build()
LogConfiguration object.LogConfiguration object