- java.lang.Object
-
- de.carne.util.logging.LogRecorder
-
public final class LogRecorder extends java.lang.ObjectThis class is used to record LogRecords in a selective manner (e.g. to display detailed results of long running operations).
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classLogRecorder.SessionThis class represents a running recording session.
-
Constructor Summary
Constructors Constructor Description LogRecorder(java.util.logging.Level level)Construct LogRecorder.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LogRecorderaddLog(Log log)Add a Log instance to the LogRecorder for recording.LogRecorderaddLogger(java.util.logging.Logger logger)Add a Logger instance to the LogRecorder for recording.LogRecorderexcludeRecord(java.util.function.Predicate<java.util.logging.LogRecord> exclude)Add an exclude Predicate to the recorder.LogRecorderincludeRecord(java.util.function.Predicate<java.util.logging.LogRecord> include)Add an include Predicate to the recorder.LogRecorder.Sessionstart(boolean currentThreadOnly)Start the recording LogRecorder.Session.
-
-
-
Constructor Detail
-
LogRecorder
public LogRecorder(java.util.logging.Level level)
Construct LogRecorder.- Parameters:
level- The Level to use for LogRecord filtering (all LogRecords below this level are ignored).
-
-
Method Detail
-
includeRecord
public LogRecorder includeRecord(java.util.function.Predicate<java.util.logging.LogRecord> include)
Add an include Predicate to the recorder.To be recorded an issued LogRecord must match at least one of the include Predicates.
- Parameters:
include- The include Predicate to apply.- Returns:
- The updated LogRecorder.
-
excludeRecord
public LogRecorder excludeRecord(java.util.function.Predicate<java.util.logging.LogRecord> exclude)
Add an exclude Predicate to the recorder.To be recorded an issued LogRecord must not match any of the exclude Predicates.
- Parameters:
exclude- The exclude Predicate to apply.- Returns:
- The updated LogRecorder.
-
addLog
public LogRecorder addLog(Log log)
Add a Log instance to the LogRecorder for recording.- Parameters:
log- The Log instance to add to the recording.- Returns:
- The updated LogRecorder.
-
addLogger
public LogRecorder addLogger(java.util.logging.Logger logger)
Add a Logger instance to the LogRecorder for recording.- Parameters:
logger- The Logger instance to add to the recording.- Returns:
- The updated LogRecorder.
-
start
public LogRecorder.Session start(boolean currentThreadOnly)
Start the recording LogRecorder.Session.After this method has been invoked the LogRecorder collects all LogRecords that
- issued via one of the added loggers
- match the setup filtering
- Parameters:
currentThreadOnly- Whether to include only LogRecords issued by the current Thread.- Returns:
- The started LogRecorder.Session.
-
-