|
qflib 0.99 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.qfs.lib.log.AbstractLogUser
de.qfs.lib.log.LevelFilter
A simple LogFilter
that filters messages based on their
level.
It considers all messages with a level less than or equal to the given
maximum as useful. If a LogWriter
has been set, all
useful messages will be written to it. By setting the maximum level to a
value < 0, filtering can be turned off, so all messages are passed to the
writer.
Whether a message is passed on through the filter chain depends on whether
it is considered useful and on the mode setting as described for the LogUser
interface.
Field Summary |
Fields inherited from class de.qfs.lib.log.AbstractLogUser |
mode |
Fields inherited from interface de.qfs.lib.log.LogUser |
FILTER_ALL, FILTER_NONE, FILTER_UNUSED, FILTER_USED |
Constructor Summary | |
LevelFilter(int level)
Create a new LevelFilter with mode FILTER_UNUSED and no LogWriter . |
|
LevelFilter(int level,
int mode,
LogWriter writer)
Create a new LevelFilter. |
|
LevelFilter(int level,
LogWriter writer)
Create a new LevelFilter with mode FILTER_USED . |
Method Summary | |
LogEntry[] |
filter(LogEntry[] entries)
Filter an array of LogEntries, possibly writing some of them to the LogWriter. |
int |
getLevel()
Get the level limiting the filtering and writing of messages. |
protected boolean |
isUseful(LogEntry entry)
Decide whether a log message is useful and should be passed to the log writer. |
void |
setLevel(int level)
Set the level limiting the filtering and writing of messages. |
Methods inherited from class de.qfs.lib.log.AbstractLogUser |
filter, getLogWriter, setFilterMode, setLogWriter |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public LevelFilter(int level)
FILTER_UNUSED
and no LogWriter
.
level
- Only messages up to the returned level will be passed
on and possibly written to the LogWriter.public LevelFilter(int level, LogWriter writer)
FILTER_USED
.
level
- Only messages up to the returned level will be passed
on and possibly written to the LogWriter.writer
- The LogWriter used to write LogEntries that pass the
filter setting.public LevelFilter(int level, int mode, LogWriter writer)
level
- Only messages up to the returned level will be passed
on and possibly written to the LogWriter.mode
- The LogUser
mode.writer
- The LogWriter used to write LogEntries that pass the
filter setting.Method Detail |
public final int getLevel()
public final void setLevel(int level)
level
- Only messages up to the returned level will be passed
on and possibly written to the LogWriter.public LogEntry[] filter(LogEntry[] entries)
filter
in interface LogFilter
filter
in class AbstractLogUser
entries
- The entries to filter.protected boolean isUseful(LogEntry entry)
isUseful
in class AbstractLogUser
entry
- The LogEntry to check.
|
qflib 0.99 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |