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()
Deprecated.
use
enableBorder() instead, since 1.7.1 |
LogConfiguration.Builder |
borderFormatter(BorderFormatter borderFormatter)
Set the border formatter used when logging.
|
LogConfiguration |
build()
Builds configured
LogConfiguration object. |
LogConfiguration.Builder |
disableBorder()
Disable border, the log content won't be surrounded by a border.
|
LogConfiguration.Builder |
disableStackTrace()
Disable stack trace, the stack trace won't be printed with the log message.
|
LogConfiguration.Builder |
disableThreadInfo()
Disable thread info, the thread info won't be printed with the log message.
|
LogConfiguration.Builder |
enableBorder()
Enable border, the border would surround the entire log content, and separate the log
message, thread info and stack trace.
|
LogConfiguration.Builder |
enableStackTrace(int depth)
Enable stack trace, the stack trace would be printed with the log message.
|
LogConfiguration.Builder |
enableStackTrace(java.lang.String stackTraceOrigin,
int depth)
Enable stack trace, the stack trace would be printed with the log message.
|
LogConfiguration.Builder |
enableThreadInfo()
Enable thread info, the thread info would be printed with the log message.
|
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()
Deprecated.
use
disableBorder() instead, since 1.7.1 |
LogConfiguration.Builder |
nst()
Deprecated.
use
disableStackTrace() instead, since 1.7.1 |
LogConfiguration.Builder |
nt()
Deprecated.
use
disableThreadInfo() instead, since 1.7.1 |
LogConfiguration.Builder |
st(int depth)
Deprecated.
use
enableStackTrace(int) instead, since 1.7.1 |
LogConfiguration.Builder |
st(java.lang.String stackTraceOrigin,
int depth)
Deprecated.
use
enableStackTrace(String, int) instead, since 1.7.1 |
LogConfiguration.Builder |
stackTraceFormatter(StackTraceFormatter stackTraceFormatter)
Set the stack trace formatter used when logging.
|
LogConfiguration.Builder |
t()
Deprecated.
use
enableThreadInfo() instead, since 1.7.1 |
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()
enableThreadInfo() instead, since 1.7.1public LogConfiguration.Builder enableThreadInfo()
ThreadFormatterpublic LogConfiguration.Builder nt()
disableThreadInfo() instead, since 1.7.1public LogConfiguration.Builder disableThreadInfo()
public LogConfiguration.Builder st(int depth)
enableStackTrace(int) instead, since 1.7.1depth - the number of stack trace elements we should log, 0 if no limitationpublic LogConfiguration.Builder enableStackTrace(int depth)
depth - the number of stack trace elements we should log, 0 if no limitationStackTraceFormatterpublic LogConfiguration.Builder st(java.lang.String stackTraceOrigin, int depth)
enableStackTrace(String, int) instead, since 1.7.1stackTraceOrigin - 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 enableStackTrace(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 limitationStackTraceFormatterpublic LogConfiguration.Builder nst()
disableStackTrace() instead, since 1.7.1public LogConfiguration.Builder disableStackTrace()
StackTraceFormatterpublic LogConfiguration.Builder b()
enableBorder() instead, since 1.7.1public LogConfiguration.Builder enableBorder()
BorderFormatterpublic LogConfiguration.Builder nb()
disableBorder() instead, since 1.7.1public LogConfiguration.Builder disableBorder()
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