public class BasicMessageLogger extends Object implements MessageLogger
MessageBuilder
and prints them to the standard
output stream.System.out
Modifier and Type | Field and Description |
---|---|
static BasicMessageLogger |
INSTANCE
An instance of BasicMessageLogger.
|
Constructor and Description |
---|
BasicMessageLogger()
Creates an instance using
BasicMessageBuilder.INSTANCE to build the messages. |
BasicMessageLogger(MessageBuilder builder)
Creates an instance passing the message builder used to build the messages.
|
Modifier and Type | Method and Description |
---|---|
MessageBuilder |
getMessageBuilder()
Gets the message builder used to build the messages.
|
void |
log(char level,
String category,
int id)
Logs a message.
|
void |
log(char level,
String category,
int id,
Object... arguments)
Logs a message with arguments.
|
void |
log(char level,
String category,
int id,
Throwable t)
Logs a message with a throwable.
|
void |
log(char level,
String category,
int id,
Throwable t,
Object... arguments)
Logs a message with a throwable and arguments.
|
void |
setMessageBuilder(MessageBuilder builder)
Sets the message builder used to build the messages.
|
public static final BasicMessageLogger INSTANCE
public BasicMessageLogger()
BasicMessageBuilder.INSTANCE
to build the messages.public BasicMessageLogger(MessageBuilder builder)
builder
- the MessageBuilder
to use, cannot be null
.NullPointerException
- if the given builder is null
.public MessageBuilder getMessageBuilder()
MessageLogger
getMessageBuilder
in interface MessageLogger
public void log(char level, String category, int id)
MessageLogger
log
in interface MessageLogger
level
- the level of the message.category
- the category of the message.id
- the ID of the message.MessageBuilder.buildMessage(char, String, int)
public void log(char level, String category, int id, Object... arguments)
MessageLogger
log
in interface MessageLogger
level
- the level of the message.category
- the category of the message.id
- the ID of the message.arguments
- the arguments.MessageBuilder.buildMessage(char, String, int, Object...)
public void log(char level, String category, int id, Throwable t)
MessageLogger
log
in interface MessageLogger
level
- the level of the message.category
- the category of the message.id
- the ID of the message.t
- the throwable.MessageBuilder.buildMessage(char, String, int, Throwable)
public void log(char level, String category, int id, Throwable t, Object... arguments)
MessageLogger
log
in interface MessageLogger
level
- the level of the message.category
- the category of the message.id
- the ID of the message.t
- the throwable.arguments
- the arguments.MessageBuilder.buildMessage(char, String, int, Throwable, Object...)
public void setMessageBuilder(MessageBuilder builder)
MessageLogger
setMessageBuilder
in interface MessageLogger
builder
- the message builder to set, cannot be null
.