ch.javasoft.util.logging
Class LevelFilter

java.lang.Object
  extended by ch.javasoft.util.logging.LevelFilter
All Implemented Interfaces:
Filter

public class LevelFilter
extends Object
implements Filter

A filter for log messages based on the log level. Only log records above or below a certain level pass the filter.


Nested Class Summary
static class LevelFilter.Type
          The filter type, somewhat like a comparison operator for the threshold level and the log record's log level
 
Constructor Summary
LevelFilter()
          Default constructor, reads filter type and threshold from logger config.
LevelFilter(LevelFilter.Type filterType, Level threshold)
          Constructor with threshold and filter type.
 
Method Summary
 boolean isLoggable(LogRecord record)
          Returns true if the level of the log record is filterType than the threshold level.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LevelFilter

public LevelFilter()
Default constructor, reads filter type and threshold from logger config.

The config is expected to look like this:


LevelFilter

public LevelFilter(LevelFilter.Type filterType,
                   Level threshold)
Constructor with threshold and filter type. The level of the log record must be filterType than the threshold level to pass the filter.

Parameters:
filterType - comparison operator for levels
threshold - threshold for right hand side of comparison
Method Detail

isLoggable

public boolean isLoggable(LogRecord record)
Returns true if the level of the log record is filterType than the threshold level.

Specified by:
isLoggable in interface Filter