public class Logger extends Object
LogBackend
interface and provides {} argument features like slf4j. It allows us to plug
in additional log backends if necessary.
From SimpleLogging: https://github.com/j256/simplelogging
NOTE: We do the (msg, arg0), (msg, arg0, arg1), (msg, arg0, arg1, arg2), (msg, arg0, arg1, arg2, arg3), and (msg, argArray) patterns because if we do ... for everything, we will get a new Object[] each log call which we don't want -- even if the message is never logged because of the log level. Also, we don't use ... at all because we want to know when we are creating a new Object[] so we can make sure it is what we want. I thought ... was so much better than slf4j but it turns out they were spot on. Sigh.
NOTE: When you are using the argArray methods, you should consider wrapping the call in an if
so the
Object[]
won't be created unnecessarily.
if (logger.isLevelEnabled(Level...)) ...
Constructor and Description |
---|
Logger(LogBackend backend) |
Modifier and Type | Method and Description |
---|---|
void |
debug(String msg)
Log a debug message.
|
void |
debug(String msg,
Object arg0)
Log a debug message.
|
void |
debug(String msg,
Object[] argArray)
Log a debug message.
|
void |
debug(String msg,
Object arg0,
Object arg1)
Log a debug message.
|
void |
debug(String msg,
Object arg0,
Object arg1,
Object arg2)
Log a debug message.
|
void |
debug(String msg,
Object arg0,
Object arg1,
Object arg2,
Object arg3)
Log a debug message.
|
void |
debug(Throwable throwable,
String msg)
Log a debug message with a throwable.
|
void |
debug(Throwable throwable,
String msg,
Object arg0)
Log a debug message with a throwable.
|
void |
debug(Throwable throwable,
String msg,
Object[] argArray)
Log a debug message with a throwable.
|
void |
debug(Throwable throwable,
String msg,
Object arg0,
Object arg1)
Log a debug message with a throwable.
|
void |
debug(Throwable throwable,
String msg,
Object arg0,
Object arg1,
Object arg2)
Log a debug message with a throwable.
|
void |
debug(Throwable throwable,
String msg,
Object arg0,
Object arg1,
Object arg2,
Object arg3)
Log a debug message with a throwable.
|
void |
error(String msg)
Log a error message.
|
void |
error(String msg,
Object arg0)
Log a error message.
|
void |
error(String msg,
Object[] argArray)
Log a error message.
|
void |
error(String msg,
Object arg0,
Object arg1)
Log a error message.
|
void |
error(String msg,
Object arg0,
Object arg1,
Object arg2)
Log a error message.
|
void |
error(String msg,
Object arg0,
Object arg1,
Object arg2,
Object arg3)
Log a error message.
|
void |
error(Throwable throwable,
String msg)
Log a error message with a throwable.
|
void |
error(Throwable throwable,
String msg,
Object arg0)
Log a error message with a throwable.
|
void |
error(Throwable throwable,
String msg,
Object[] argArray)
Log a error message with a throwable.
|
void |
error(Throwable throwable,
String msg,
Object arg0,
Object arg1)
Log a error message with a throwable.
|
void |
error(Throwable throwable,
String msg,
Object arg0,
Object arg1,
Object arg2)
Log a error message with a throwable.
|
void |
error(Throwable throwable,
String msg,
Object arg0,
Object arg1,
Object arg2,
Object arg3)
Log a error message with a throwable.
|
void |
fatal(String msg)
Log a fatal message.
|
void |
fatal(String msg,
Object arg0)
Log a fatal message.
|
void |
fatal(String msg,
Object[] argArray)
Log a fatal message.
|
void |
fatal(String msg,
Object arg0,
Object arg1)
Log a fatal message.
|
void |
fatal(String msg,
Object arg0,
Object arg1,
Object arg2)
Log a fatal message.
|
void |
fatal(String msg,
Object arg0,
Object arg1,
Object arg2,
Object arg3)
Log a fatal message.
|
void |
fatal(Throwable throwable,
String msg)
Log a fatal message with a throwable.
|
void |
fatal(Throwable throwable,
String msg,
Object arg0)
Log a fatal message with a throwable.
|
void |
fatal(Throwable throwable,
String msg,
Object[] argArray)
Log a fatal message with a throwable.
|
void |
fatal(Throwable throwable,
String msg,
Object arg0,
Object arg1)
Log a fatal message with a throwable.
|
void |
fatal(Throwable throwable,
String msg,
Object arg0,
Object arg1,
Object arg2)
Log a fatal message with a throwable.
|
void |
fatal(Throwable throwable,
String msg,
Object arg0,
Object arg1,
Object arg2,
Object arg3)
Log a fatal message with a throwable.
|
LogBackend |
getLogBackend()
Get the underlying log backend implementation for testing purposes.
|
void |
info(String msg)
Log a info message.
|
void |
info(String msg,
Object arg0)
Log a info message.
|
void |
info(String msg,
Object[] argArray)
Log a info message.
|
void |
info(String msg,
Object arg0,
Object arg1)
Log a info message.
|
void |
info(String msg,
Object arg0,
Object arg1,
Object arg2)
Log a info message.
|
void |
info(String msg,
Object arg0,
Object arg1,
Object arg2,
Object arg3)
Log a info message.
|
void |
info(Throwable throwable,
String msg)
Log a info message with a throwable.
|
void |
info(Throwable throwable,
String msg,
Object arg0)
Log a info message with a throwable.
|
void |
info(Throwable throwable,
String msg,
Object[] argArray)
Log a info message with a throwable.
|
void |
info(Throwable throwable,
String msg,
Object arg0,
Object arg1)
Log a info message with a throwable.
|
void |
info(Throwable throwable,
String msg,
Object arg0,
Object arg1,
Object arg2)
Log a info message with a throwable.
|
void |
info(Throwable throwable,
String msg,
Object arg0,
Object arg1,
Object arg2,
Object arg3)
Log a info message with a throwable.
|
boolean |
isLevelEnabled(Level level)
Return if logging level is enabled.
|
void |
log(Level level,
String msg)
Log a message at the provided level.
|
void |
log(Level level,
String msg,
Object arg0)
Log a message at the provided level.
|
void |
log(Level level,
String msg,
Object[] argArray)
Log a message at the provided level.
|
void |
log(Level level,
String msg,
Object arg0,
Object arg1)
Log a message at the provided level.
|
void |
log(Level level,
String msg,
Object arg0,
Object arg1,
Object arg2)
Log a message at the provided level.
|
void |
log(Level level,
String msg,
Object arg0,
Object arg1,
Object arg2,
Object arg3)
Log a message at the provided level.
|
void |
log(Level level,
Throwable throwable,
String msg)
Log a message with a throwable at the provided level.
|
void |
log(Level level,
Throwable throwable,
String msg,
Object arg0)
Log a message with a throwable at the provided level.
|
void |
log(Level level,
Throwable throwable,
String msg,
Object[] argArray)
Log a message with a throwable at the provided level.
|
void |
log(Level level,
Throwable throwable,
String msg,
Object arg0,
Object arg1)
Log a message with a throwable at the provided level.
|
void |
log(Level level,
Throwable throwable,
String msg,
Object arg0,
Object arg1,
Object arg2)
Log a message with a throwable at the provided level.
|
void |
log(Level level,
Throwable throwable,
String msg,
Object arg0,
Object arg1,
Object arg2,
Object arg3)
Log a message with a throwable at the provided level.
|
static void |
setGlobalLogLevel(Level level)
Set the log level for all of the loggers.
|
void |
trace(String msg)
Log a trace message.
|
void |
trace(String msg,
Object arg0)
Log a trace message.
|
void |
trace(String msg,
Object[] argArray)
Log a trace message.
|
void |
trace(String msg,
Object arg0,
Object arg1)
Log a trace message.
|
void |
trace(String msg,
Object arg0,
Object arg1,
Object arg2)
Log a trace message.
|
void |
trace(String msg,
Object arg0,
Object arg1,
Object arg2,
Object arg3)
Log a trace message.
|
void |
trace(Throwable throwable,
String msg)
Log a trace message with a throwable.
|
void |
trace(Throwable throwable,
String msg,
Object arg0)
Log a trace message with a throwable.
|
void |
trace(Throwable throwable,
String msg,
Object[] argArray)
Log a trace message with a throwable.
|
void |
trace(Throwable throwable,
String msg,
Object arg0,
Object arg1)
Log a trace message with a throwable.
|
void |
trace(Throwable throwable,
String msg,
Object arg0,
Object arg1,
Object arg2)
Log a trace message with a throwable.
|
void |
trace(Throwable throwable,
String msg,
Object arg0,
Object arg1,
Object arg2,
Object arg3)
Log a trace message with a throwable.
|
void |
warn(String msg)
Log a warning message.
|
void |
warn(String msg,
Object arg0)
Log a warning message.
|
void |
warn(String msg,
Object[] argArray)
Log a warning message.
|
void |
warn(String msg,
Object arg0,
Object arg1)
Log a warning message.
|
void |
warn(String msg,
Object arg0,
Object arg1,
Object arg2)
Log a warning message.
|
void |
warn(String msg,
Object arg0,
Object arg1,
Object arg2,
Object arg3)
Log a warning message.
|
void |
warn(Throwable throwable,
String msg)
Log a warning message with a throwable.
|
void |
warn(Throwable throwable,
String msg,
Object arg0)
Log a warning message with a throwable.
|
void |
warn(Throwable throwable,
String msg,
Object[] argArray)
Log a warning message with a throwable.
|
void |
warn(Throwable throwable,
String msg,
Object arg0,
Object arg1)
Log a warning message with a throwable.
|
void |
warn(Throwable throwable,
String msg,
Object arg0,
Object arg1,
Object arg2)
Log a warning message with a throwable.
|
void |
warn(Throwable throwable,
String msg,
Object arg0,
Object arg1,
Object arg2,
Object arg3)
Log a warning message with a throwable.
|
public Logger(LogBackend backend)
public static void setGlobalLogLevel(Level level)
public boolean isLevelEnabled(Level level)
public void trace(String msg)
public void trace(String msg, Object arg0, Object arg1, Object arg2, Object arg3)
public void trace(Throwable throwable, String msg, Object arg0)
public void trace(Throwable throwable, String msg, Object arg0, Object arg1)
public void trace(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2)
public void trace(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2, Object arg3)
public void trace(Throwable throwable, String msg, Object[] argArray)
public void debug(String msg)
public void debug(String msg, Object arg0, Object arg1, Object arg2, Object arg3)
public void debug(Throwable throwable, String msg, Object arg0)
public void debug(Throwable throwable, String msg, Object arg0, Object arg1)
public void debug(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2)
public void debug(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2, Object arg3)
public void debug(Throwable throwable, String msg, Object[] argArray)
public void info(String msg)
public void info(String msg, Object arg0, Object arg1, Object arg2, Object arg3)
public void info(Throwable throwable, String msg, Object arg0)
public void info(Throwable throwable, String msg, Object arg0, Object arg1)
public void info(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2)
public void info(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2, Object arg3)
public void info(Throwable throwable, String msg, Object[] argArray)
public void warn(String msg)
public void warn(String msg, Object arg0, Object arg1, Object arg2, Object arg3)
public void warn(Throwable throwable, String msg, Object arg0)
public void warn(Throwable throwable, String msg, Object arg0, Object arg1)
public void warn(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2)
public void warn(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2, Object arg3)
public void warn(Throwable throwable, String msg, Object[] argArray)
public void error(String msg)
public void error(String msg, Object arg0, Object arg1, Object arg2, Object arg3)
public void error(Throwable throwable, String msg, Object arg0)
public void error(Throwable throwable, String msg, Object arg0, Object arg1)
public void error(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2)
public void error(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2, Object arg3)
public void error(Throwable throwable, String msg, Object[] argArray)
public void fatal(String msg)
public void fatal(String msg, Object arg0, Object arg1, Object arg2, Object arg3)
public void fatal(Throwable throwable, String msg, Object arg0)
public void fatal(Throwable throwable, String msg, Object arg0, Object arg1)
public void fatal(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2)
public void fatal(Throwable throwable, String msg, Object arg0, Object arg1, Object arg2, Object arg3)
public void fatal(Throwable throwable, String msg, Object[] argArray)
public void log(Level level, String msg, Object arg0, Object arg1)
public void log(Level level, String msg, Object arg0, Object arg1, Object arg2)
public void log(Level level, String msg, Object arg0, Object arg1, Object arg2, Object arg3)
public void log(Level level, String msg, Object[] argArray)
public void log(Level level, Throwable throwable, String msg)
public void log(Level level, Throwable throwable, String msg, Object arg0)
public void log(Level level, Throwable throwable, String msg, Object arg0, Object arg1)
public void log(Level level, Throwable throwable, String msg, Object arg0, Object arg1, Object arg2)
public void log(Level level, Throwable throwable, String msg, Object arg0, Object arg1, Object arg2, Object arg3)
public void log(Level level, Throwable throwable, String msg, Object[] argArray)
public LogBackend getLogBackend()
This documentation is licensed by Gray Watson under the Creative Commons Attribution-Share Alike 3.0 License.