public class FilterMessageLogger extends Object implements MessageLogger
MessageBuilder and prints them to the standard output
stream when the message level is higher that logger threshold.System.out| Modifier and Type | Field and Description |
|---|---|
static char |
ALL
Print all message.
|
static FilterMessageLogger |
INSTANCE
An instance of FilterMessageLogger.
|
static char |
OFF
Print no messages.
|
| Constructor and Description |
|---|
FilterMessageLogger()
Creates an instance using
BasicMessageBuilder.INSTANCE to build the messages. |
FilterMessageLogger(MessageBuilder builder)
Creates an instance passing the message builder used to build the messages.
|
FilterMessageLogger(MessageBuilder builder,
char level)
Creates an instance passing the message builder used to build the messages.
|
| Modifier and Type | Method and Description |
|---|---|
char |
getLevel()
Gets the level of the logger.
|
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 |
setLevel(char level)
Sets the level of the logger.
|
void |
setMessageBuilder(MessageBuilder builder)
Sets the message builder used to build the messages.
|
public static final char ALL
public static final FilterMessageLogger INSTANCE
public static final char OFF
public FilterMessageLogger()
BasicMessageBuilder.INSTANCE to build the messages.public FilterMessageLogger(MessageBuilder builder)
Level.INFO.builder - the MessageBuilder to use, cannot be null.NullPointerException - if the given builder is null.public FilterMessageLogger(MessageBuilder builder, char level)
builder - the MessageBuilder to use, cannot be null.level - the print level threshold.NullPointerException - if the given builder is null.public char getLevel()
public MessageBuilder getMessageBuilder()
MessageLoggergetMessageBuilder in interface MessageLoggerpublic void log(char level,
String category,
int id)
MessageLoggerlog in interface MessageLoggerlevel - 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)
MessageLoggerlog in interface MessageLoggerlevel - 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)
MessageLoggerlog in interface MessageLoggerlevel - 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)
MessageLoggerlog in interface MessageLoggerlevel - 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 setLevel(char level)
throws IllegalArgumentException
level - the level to use.IllegalArgumentException - if the given level is not valid.public void setMessageBuilder(MessageBuilder builder)
MessageLoggersetMessageBuilder in interface MessageLoggerbuilder - the message builder to set, cannot be null.