Package com.elvishew.xlog
Class Logger
- java.lang.Object
-
- com.elvishew.xlog.Logger
-
public class Logger extends java.lang.ObjectA logger is used to do the real logging work, can use multiple log printers to print the log.A
Loggeris always generated and mostly accessed byXLog, but for customization purpose, you can configure aLoggervia theLogger.Builderwhich is returned byXLogwhen you trying to start a customization usingXLog.tag(String)or other configuration method, and to use the customizedLogger, you should call theLogger.Builder.build()to build aLogger, and then you can log using theLoggerassuming that you are using theXLogdirectly.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLogger.BuilderBuilder forLogger.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidd(java.lang.Object object)Log an object with levelLogLevel.DEBUG.voidd(java.lang.Object[] array)Log an array with levelLogLevel.DEBUG.voidd(java.lang.String msg)Log a message with levelLogLevel.DEBUG.voidd(java.lang.String format, java.lang.Object... args)Log a message with levelLogLevel.DEBUG.voidd(java.lang.String msg, java.lang.Throwable tr)Log a message and a throwable with levelLogLevel.DEBUG.voide(java.lang.Object object)Log an object with levelLogLevel.ERROR.voide(java.lang.Object[] array)Log an array with levelLogLevel.ERROR.voide(java.lang.String msg)Log a message with levelLogLevel.ERROR.voide(java.lang.String format, java.lang.Object... args)Log a message with levelLogLevel.ERROR.voide(java.lang.String msg, java.lang.Throwable tr)Log a message and a throwable with levelLogLevel.ERROR.voidi(java.lang.Object object)Log an object with levelLogLevel.INFO.voidi(java.lang.Object[] array)Log an array with levelLogLevel.INFO.voidi(java.lang.String msg)Log a message with levelLogLevel.INFO.voidi(java.lang.String format, java.lang.Object... args)Log a message with levelLogLevel.INFO.voidi(java.lang.String msg, java.lang.Throwable tr)Log a message and a throwable with levelLogLevel.INFO.voidjson(java.lang.String json)Log a JSON string, with levelLogLevel.DEBUGby default.voidlog(int logLevel, java.lang.Object object)Log an object with specific log level.voidlog(int logLevel, java.lang.Object[] array)Log an array with specific log level.voidlog(int logLevel, java.lang.String msg)Log a message with specific log level.voidlog(int logLevel, java.lang.String format, java.lang.Object... args)Log a message with specific log level.voidlog(int logLevel, java.lang.String msg, java.lang.Throwable tr)Log a message and a throwable with specific log level.voidv(java.lang.Object object)Log an object with levelLogLevel.VERBOSE.voidv(java.lang.Object[] array)Log an array with levelLogLevel.VERBOSE.voidv(java.lang.String msg)Log a message with levelLogLevel.VERBOSE.voidv(java.lang.String format, java.lang.Object... args)Log a message with levelLogLevel.VERBOSE.voidv(java.lang.String msg, java.lang.Throwable tr)Log a message and a throwable with levelLogLevel.VERBOSE.voidw(java.lang.Object object)Log an object with levelLogLevel.WARN.voidw(java.lang.Object[] array)Log an array with levelLogLevel.WARN.voidw(java.lang.String msg)Log a message with levelLogLevel.WARN.voidw(java.lang.String format, java.lang.Object... args)Log a message with levelLogLevel.WARN.voidw(java.lang.String msg, java.lang.Throwable tr)Log a message and a throwable with levelLogLevel.WARN.voidxml(java.lang.String xml)Log a XML string, with levelLogLevel.DEBUGby default.
-
-
-
Method Detail
-
v
public void v(java.lang.Object object)
Log an object with levelLogLevel.VERBOSE.- Parameters:
object- the object to log- Since:
- 1.1.0
- See Also:
Logger.Builder.addObjectFormatter(Class, ObjectFormatter)
-
v
public void v(java.lang.Object[] array)
Log an array with levelLogLevel.VERBOSE.- Parameters:
array- the array to log
-
v
public void v(java.lang.String format, java.lang.Object... args)Log a message with levelLogLevel.VERBOSE.- Parameters:
format- the format of the message to logargs- the arguments of the message to log
-
v
public void v(java.lang.String msg)
Log a message with levelLogLevel.VERBOSE.- Parameters:
msg- the message to log
-
v
public void v(java.lang.String msg, java.lang.Throwable tr)Log a message and a throwable with levelLogLevel.VERBOSE.- Parameters:
msg- the message to logtr- the throwable to be log
-
d
public void d(java.lang.Object object)
Log an object with levelLogLevel.DEBUG.- Parameters:
object- the object to log- Since:
- 1.1.0
- See Also:
Logger.Builder.addObjectFormatter(Class, ObjectFormatter)
-
d
public void d(java.lang.Object[] array)
Log an array with levelLogLevel.DEBUG.- Parameters:
array- the array to log
-
d
public void d(java.lang.String format, java.lang.Object... args)Log a message with levelLogLevel.DEBUG.- Parameters:
format- the format of the message to log, null if just need to concat argumentsargs- the arguments of the message to log
-
d
public void d(java.lang.String msg)
Log a message with levelLogLevel.DEBUG.- Parameters:
msg- the message to log
-
d
public void d(java.lang.String msg, java.lang.Throwable tr)Log a message and a throwable with levelLogLevel.DEBUG.- Parameters:
msg- the message to logtr- the throwable to be log
-
i
public void i(java.lang.Object object)
Log an object with levelLogLevel.INFO.- Parameters:
object- the object to log- Since:
- 1.1.0
- See Also:
Logger.Builder.addObjectFormatter(Class, ObjectFormatter)
-
i
public void i(java.lang.Object[] array)
Log an array with levelLogLevel.INFO.- Parameters:
array- the array to log
-
i
public void i(java.lang.String format, java.lang.Object... args)Log a message with levelLogLevel.INFO.- Parameters:
format- the format of the message to log, null if just need to concat argumentsargs- the arguments of the message to log
-
i
public void i(java.lang.String msg)
Log a message with levelLogLevel.INFO.- Parameters:
msg- the message to log
-
i
public void i(java.lang.String msg, java.lang.Throwable tr)Log a message and a throwable with levelLogLevel.INFO.- Parameters:
msg- the message to logtr- the throwable to be log
-
w
public void w(java.lang.Object object)
Log an object with levelLogLevel.WARN.- Parameters:
object- the object to log- Since:
- 1.1.0
- See Also:
Logger.Builder.addObjectFormatter(Class, ObjectFormatter)
-
w
public void w(java.lang.Object[] array)
Log an array with levelLogLevel.WARN.- Parameters:
array- the array to log
-
w
public void w(java.lang.String format, java.lang.Object... args)Log a message with levelLogLevel.WARN.- Parameters:
format- the format of the message to log, null if just need to concat argumentsargs- the arguments of the message to log
-
w
public void w(java.lang.String msg)
Log a message with levelLogLevel.WARN.- Parameters:
msg- the message to log
-
w
public void w(java.lang.String msg, java.lang.Throwable tr)Log a message and a throwable with levelLogLevel.WARN.- Parameters:
msg- the message to logtr- the throwable to be log
-
e
public void e(java.lang.Object object)
Log an object with levelLogLevel.ERROR.- Parameters:
object- the object to log- Since:
- 1.1.0
- See Also:
Logger.Builder.addObjectFormatter(Class, ObjectFormatter)
-
e
public void e(java.lang.Object[] array)
Log an array with levelLogLevel.ERROR.- Parameters:
array- the array to log
-
e
public void e(java.lang.String format, java.lang.Object... args)Log a message with levelLogLevel.ERROR.- Parameters:
format- the format of the message to log, null if just need to concat argumentsargs- the arguments of the message to log
-
e
public void e(java.lang.String msg)
Log a message with levelLogLevel.ERROR.- Parameters:
msg- the message to log
-
e
public void e(java.lang.String msg, java.lang.Throwable tr)Log a message and a throwable with levelLogLevel.ERROR.- Parameters:
msg- the message to logtr- the throwable to be log
-
log
public void log(int logLevel, java.lang.Object object)Log an object with specific log level.- Parameters:
logLevel- the specific log levelobject- the object to log- Since:
- 1.4.0
- See Also:
Logger.Builder.addObjectFormatter(Class, ObjectFormatter)
-
log
public void log(int logLevel, java.lang.Object[] array)Log an array with specific log level.- Parameters:
logLevel- the specific log levelarray- the array to log- Since:
- 1.4.0
-
log
public void log(int logLevel, java.lang.String format, java.lang.Object... args)Log a message with specific log level.- Parameters:
logLevel- the specific log levelformat- the format of the message to log, null if just need to concat argumentsargs- the arguments of the message to log- Since:
- 1.4.0
-
log
public void log(int logLevel, java.lang.String msg)Log a message with specific log level.- Parameters:
logLevel- the specific log levelmsg- the message to log- Since:
- 1.4.0
-
log
public void log(int logLevel, java.lang.String msg, java.lang.Throwable tr)Log a message and a throwable with specific log level.- Parameters:
logLevel- the specific log levelmsg- the message to logtr- the throwable to be log- Since:
- 1.4.0
-
json
public void json(java.lang.String json)
Log a JSON string, with levelLogLevel.DEBUGby default.- Parameters:
json- the JSON string to log
-
xml
public void xml(java.lang.String xml)
Log a XML string, with levelLogLevel.DEBUGby default.- Parameters:
xml- the XML string to log
-
-