More convenience constructors in LoggingHandler

This commit is contained in:
Trustin Lee 2009-07-15 01:40:16 +00:00
parent a53388b859
commit 44110a281e

View File

@ -64,6 +64,16 @@ public class LoggingHandler implements ChannelUpstreamHandler, ChannelDownstream
this(true);
}
/**
* Creates a new instance whose logger name is the fully qualified class
* name of the instance.
*
* @param level the log level
*/
public LoggingHandler(InternalLogLevel level) {
this(level, true);
}
/**
* Creates a new instance whose logger name is the fully qualified class
* name of the instance.
@ -72,8 +82,24 @@ public class LoggingHandler implements ChannelUpstreamHandler, ChannelDownstream
* message is logged
*/
public LoggingHandler(boolean hexDump) {
this(DEFAULT_LEVEL, hexDump);
}
/**
* Creates a new instance whose logger name is the fully qualified class
* name of the instance.
*
* @param level the log level
* @param hexDump {@code true} if and only if the hex dump of the received
* message is logged
*/
public LoggingHandler(InternalLogLevel level, boolean hexDump) {
if (level == null) {
throw new NullPointerException("level");
}
logger = InternalLoggerFactory.getInstance(getClass());
level = DEFAULT_LEVEL;
this.level = level;
this.hexDump = hexDump;
}
@ -95,6 +121,15 @@ public class LoggingHandler implements ChannelUpstreamHandler, ChannelDownstream
this(clazz, DEFAULT_LEVEL, hexDump);
}
/**
* Creates a new instance with the specified logger name.
*
* @param level the log level
*/
public LoggingHandler(Class<?> clazz, InternalLogLevel level) {
this(clazz, level, true);
}
/**
* Creates a new instance with the specified logger name.
*