|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rice.cs.plt.debug.FilteredLogSink
public class FilteredLogSink
A LogSink that discards any messages that are not accepted by a given predicate. Messages that match are passed on to another LogSink. For convenience, a variety of Message predicate constructors are defined in the class; these can be composed with the methods in LambdaUtil.
LambdaUtil.and(Predicate, Predicate),
LambdaUtil.or(Predicate, Predicate),
LambdaUtil.negate(Predicate)| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface edu.rice.cs.plt.debug.LogSink |
|---|
LogSink.EndMessage, LogSink.ErrorMessage, LogSink.Message, LogSink.MessageVisitor<T>, LogSink.StackMessage, LogSink.StandardMessage, LogSink.StartMessage, LogSink.ValueMessage |
| Constructor Summary | |
|---|---|
FilteredLogSink(LogSink delegate,
Predicate<? super LogSink.Message> pred)
|
|
| Method Summary | |
|---|---|
static FilteredLogSink |
byLocation(LogSink delegate,
Predicate<? super java.lang.String> pred)
Create a LogSink filtered by a locationPredicate(edu.rice.cs.plt.lambda.Predicate super java.lang.String>). |
static FilteredLogSink |
byLocationBlackList(LogSink delegate,
java.lang.String... prefixes)
Create a LogSink filtered by a locationBlackListPredicate(java.lang.String...). |
static FilteredLogSink |
byLocationWhiteList(LogSink delegate,
java.lang.String... prefixes)
Create a LogSink filtered by a locationWhiteListPredicate(java.lang.String...). |
static FilteredLogSink |
byStackDepth(LogSink delegate,
int maxDepth)
Create a LogSink filtered by a stackDepthPredicate(int). |
static FilteredLogSink |
byThread(LogSink delegate,
Predicate<? super ThreadSnapshot> pred)
Create a LogSink filtered by a threadPredicate(edu.rice.cs.plt.lambda.Predicate super edu.rice.cs.plt.debug.ThreadSnapshot>). |
static FilteredLogSink |
byThreadBlackList(LogSink delegate,
java.lang.String... nameParts)
Create a LogSink filtered by a threadBlackListPredicate(java.lang.Thread...). |
static FilteredLogSink |
byThreadBlackList(LogSink delegate,
java.lang.Thread... threads)
Create a LogSink filtered by a threadBlackListPredicate(java.lang.Thread...). |
static FilteredLogSink |
byThreadWhiteList(LogSink delegate,
java.lang.String... nameParts)
Create a LogSink filtered by a threadWhiteListPredicate(java.lang.Thread...). |
static FilteredLogSink |
byThreadWhiteList(LogSink delegate,
java.lang.Thread... threads)
Create a LogSink filtered by a threadWhiteListPredicate(java.lang.Thread...). |
void |
close()
|
static Predicate<LogSink.Message> |
locationBlackListPredicate(java.lang.String... prefixes)
Produce a predicate that rejects any caller locations starting with the given prefixes. |
static Predicate<LogSink.Message> |
locationPredicate(Predicate<? super java.lang.String> pred)
Produce a predicate that accepts messages iff their caller location is accepted by pred. |
static Predicate<LogSink.Message> |
locationWhiteListPredicate(java.lang.String... prefixes)
Produce a predicate that accepts only caller locations starting with the given prefixes. |
void |
log(LogSink.StandardMessage m)
|
void |
logEnd(LogSink.EndMessage m)
|
void |
logError(LogSink.ErrorMessage m)
|
void |
logStack(LogSink.StackMessage m)
|
void |
logStart(LogSink.StartMessage m)
|
static Predicate<LogSink.Message> |
stackDepthPredicate(int maxDepth)
Produce a predicate that only accepts message with stack traces of at most the given depth. |
static Predicate<LogSink.Message> |
threadBlackListPredicate(java.lang.String... nameParts)
Produce a predicate that only accepts messages logged from threads matching the given names. |
static Predicate<LogSink.Message> |
threadBlackListPredicate(java.lang.Thread... threads)
Produce a predicate that only accepts messages logged from the given thread. |
static Predicate<LogSink.Message> |
threadPredicate(Predicate<? super ThreadSnapshot> pred)
Produce a predicate that accepts messages iff their associated ThreadSnapshot is accepted by pred. |
static Predicate<LogSink.Message> |
threadWhiteListPredicate(java.lang.String... nameParts)
Produce a predicate that only accepts messages logged from threads matching the given names. |
static Predicate<LogSink.Message> |
threadWhiteListPredicate(java.lang.Thread... threads)
Produce a predicate that only accepts messages logged from the given thread. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FilteredLogSink(LogSink delegate,
Predicate<? super LogSink.Message> pred)
| Method Detail |
|---|
public void close()
throws java.io.IOException
close in interface java.io.Closeablejava.io.IOExceptionpublic void log(LogSink.StandardMessage m)
log in interface LogSinkpublic void logEnd(LogSink.EndMessage m)
logEnd in interface LogSinkpublic void logError(LogSink.ErrorMessage m)
logError in interface LogSinkpublic void logStack(LogSink.StackMessage m)
logStack in interface LogSinkpublic void logStart(LogSink.StartMessage m)
logStart in interface LogSink
public static FilteredLogSink byLocationWhiteList(LogSink delegate,
java.lang.String... prefixes)
locationWhiteListPredicate(java.lang.String...).
public static FilteredLogSink byLocationBlackList(LogSink delegate,
java.lang.String... prefixes)
locationBlackListPredicate(java.lang.String...).
public static FilteredLogSink byLocation(LogSink delegate,
Predicate<? super java.lang.String> pred)
locationPredicate(edu.rice.cs.plt.lambda.Predicate super java.lang.String>).
public static FilteredLogSink byStackDepth(LogSink delegate,
int maxDepth)
stackDepthPredicate(int).
public static FilteredLogSink byThreadWhiteList(LogSink delegate,
java.lang.Thread... threads)
threadWhiteListPredicate(java.lang.Thread...).
public static FilteredLogSink byThreadWhiteList(LogSink delegate,
java.lang.String... nameParts)
threadWhiteListPredicate(java.lang.Thread...).
public static FilteredLogSink byThreadBlackList(LogSink delegate,
java.lang.Thread... threads)
threadBlackListPredicate(java.lang.Thread...).
public static FilteredLogSink byThreadBlackList(LogSink delegate,
java.lang.String... nameParts)
threadBlackListPredicate(java.lang.Thread...).
public static FilteredLogSink byThread(LogSink delegate,
Predicate<? super ThreadSnapshot> pred)
threadPredicate(edu.rice.cs.plt.lambda.Predicate super edu.rice.cs.plt.debug.ThreadSnapshot>).
public static Predicate<LogSink.Message> locationWhiteListPredicate(java.lang.String... prefixes)
p matches a caller location loc iff
(loc.getClassName() + "." + loc.getMethodName()).startsWith(p). If no caller information
is available, the empty string is used.
public static Predicate<LogSink.Message> locationBlackListPredicate(java.lang.String... prefixes)
p matches a caller location loc iff
(loc.getClassName() + "." + loc.getMethodName()).startsWith(p). If no caller information
is available, the empty string is used.
public static Predicate<LogSink.Message> locationPredicate(Predicate<? super java.lang.String> pred)
pred.
The caller location string is defined for a location loc as
loc.getClassName() + "." + loc.getMethodName(). If no caller information is available,
the empty string is used.
public static Predicate<LogSink.Message> stackDepthPredicate(int maxDepth)
public static Predicate<LogSink.Message> threadWhiteListPredicate(java.lang.Thread... threads)
public static Predicate<LogSink.Message> threadWhiteListPredicate(java.lang.String... nameParts)
s iff its name contains s.
public static Predicate<LogSink.Message> threadBlackListPredicate(java.lang.Thread... threads)
public static Predicate<LogSink.Message> threadBlackListPredicate(java.lang.String... nameParts)
s iff its name contains s.
public static Predicate<LogSink.Message> threadPredicate(Predicate<? super ThreadSnapshot> pred)
pred.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||