Package com.sodius.mdw.core.util.log
Class LogRecorder
- java.lang.Object
-
- com.sodius.mdw.core.util.log.AbstractLogger
-
- com.sodius.mdw.core.util.log.LogRecorder
-
- All Implemented Interfaces:
Logger
public class LogRecorder extends AbstractLogger
Creates records of logged information.Clients may instantiate or subclass this class.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLogRecorder.RecordARecordkeeps track of a logged information.
-
Constructor Summary
Constructors Constructor Description LogRecorder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Removes all records from this logger.List<LogRecorder.Record>getRecords()Return the list of recorded logged information.protected voidlog(Level level, Object message, Throwable error)Creates a record with the specified log information.protected voidrecorded(LogRecorder.Record record)Called when a record is created.
-
-
-
Method Detail
-
getRecords
public List<LogRecorder.Record> getRecords()
Return the list of recorded logged information.- Returns:
- an unmodifiable list of
Recordelements.
-
clear
public void clear()
Removes all records from this logger.
-
log
protected void log(Level level, Object message, Throwable error)
Creates a record with the specified log information.- Specified by:
login classAbstractLogger- Parameters:
level- the log level (known to be loggable).message- the information to log (usually aString), maybenull.error- an exception to log, maybenull.
-
recorded
protected void recorded(LogRecorder.Record record)
Called when a record is created. This default implementation does nothing.- Parameters:
record- the created record
-
-