public class LogRecorder extends Object implements LogListener, Iterable<LogMessage>
LogRecorder
is used to decouple the GUI displaying log messages from
the potentially highly concurrent code emitting log messages.
The recorded LogMessage
s are stored in a list. New messages can only
be added to the end of the list. The iterators never fail and are always
updated.
Constructor and Description |
---|
LogRecorder() |
Modifier and Type | Method and Description |
---|---|
void |
addObservers(Runnable observer)
The
Runnable observer will be executed, after every new log message
or text recorded. |
void |
clear() |
boolean |
isRecordCallingClass() |
Iterator<LogMessage> |
iterator()
The returned Iterator never fails, and will always be updated.
|
Iterator<LogMessage> |
iteratorAtEnd()
Same as
iterator() , but the Iterator will only return log messages
and text recorded after the iterator has been created. |
void |
messageLogged(LogMessage message)
This method is normally called from many threads in parallel.
|
void |
removeObserver(Runnable observer) |
void |
setRecordCallingClass(boolean enable) |
Stream<LogMessage> |
stream() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public void addObservers(Runnable observer)
public void removeObserver(Runnable observer)
public Iterator<LogMessage> iterator()
Iterator.hasNext()
will return true again, and
Iterator.next()
will return the new log messages element.iterator
in interface Iterable<LogMessage>
public Stream<LogMessage> stream()
public Iterator<LogMessage> iteratorAtEnd()
iterator()
, but the Iterator will only return log messages
and text recorded after the iterator has been created.public void clear()
public boolean isRecordCallingClass()
public void setRecordCallingClass(boolean enable)
public void messageLogged(LogMessage message)
LogListener
messageLogged
in interface LogListener
Copyright © 2015–2022 SciJava. All rights reserved.