public abstract class Logger extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Logger.Level |
Constructor and Description |
---|
Logger()
Same as calling
Logger(Level) with Logger.Level.INFO . |
Logger(Logger.Level level) |
Modifier and Type | Method and Description |
---|---|
void |
debug(String message)
Log a debug message.
|
void |
debug(String message,
Throwable exception)
Log a debug message.
|
void |
error(String message)
Log an error message.
|
void |
error(String message,
Throwable exception)
Log an error message.
|
protected String |
formatTag()
Combines various data to form a single string which represents the statement's tag.
|
Logger.Level |
getLevel() |
void |
info(String message)
Log an info message.
|
void |
info(String message,
Throwable exception)
Log an info message.
|
abstract void |
log(Logger.Level level,
String tag,
String message,
Throwable exception)
Write a log message to its destination.
|
void |
setLevel(Logger.Level level) |
void |
trace(String message)
Log a trace message.
|
void |
trace(String message,
Throwable exception)
Log a trace message.
|
void |
warn(String message)
Log a warn message.
|
void |
warn(String message,
Throwable exception)
Log a warn message.
|
public Logger()
Logger(Level)
with Logger.Level.INFO
.public Logger(Logger.Level level)
@Nonnull public Logger.Level getLevel()
public void setLevel(Logger.Level level)
public void trace(@Nullable String message, @Nullable Throwable exception)
null
, this call is a no-op.public void trace(@Nullable String message)
message
- if null
, this call is a no-oppublic void debug(@Nullable String message, @Nullable Throwable exception)
null
, this call is a no-op.public void debug(@Nullable String message)
message
- if null
, this call is a no-oppublic void info(@Nullable String message, @Nullable Throwable exception)
null
, this call is a no-op.public void info(@Nullable String message)
message
- if null
, this call is a no-oppublic void warn(@Nullable String message, @Nullable Throwable exception)
null
, this call is a no-op.public void warn(@Nullable String message)
message
- if null
, this call is a no-oppublic void error(@Nullable String message, @Nullable Throwable exception)
null
, this call is a no-op.public void error(@Nullable String message)
message
- if null
, this call is a no-op@Nonnull protected String formatTag()
A sane default is provided. If you have multiple log streams going into a single output channel, you may want to add additional identifier information to the tag.
public abstract void log(Logger.Level level, String tag, String message, @Nullable Throwable exception)
level
- At which the message was reportedtag
- Used to identify the source of the message. See formatTag()
.message
- That was logged. If an exception was logged, the message will already contain the exception's information.exception
- null
if no exception was reported