java.lang.Object
net.i2p.util.LogConsoleBuffer
Offer a glimpse into the last few console messages generated. Maintains two buffers, one normal and one critical.
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final UIMessagesMessages shown to the user.private final UIMessagesCritical messages, kept even when the buffer is full.private final intMost messages kept for the console.Constructor Summary
ConstructorsConstructorDescriptionLogConsoleBuffer(int limit) In theory the limit is configurable, but it isn't in the UI, so set it at construction.LogConsoleBuffer(I2PAppContext context) Uses default limit fromLogManager.Method Summary
Public MethodsModifier and TypeMethodDescription(package private) voidAdd a message to the buffer.(package private) voidaddCritical(String msg) Only adds to the critical buffer, not to both.voidclear()Clear all log entries from the buffer.Retrieve the currently buffered critical messages, earlier values were generated...Retrieve the currently buffered critical messages, earlier values were generated...Retrieve the currently buffered messages, earlier values were generated...Retrieve the currently buffered messages, earlier values were generated...
Field Details
lim
private final int limMost messages kept for the console._buffer
Messages shown to the user._critBuffer
Critical messages, kept even when the buffer is full.
Constructor Details
LogConsoleBuffer
Uses default limit fromLogManager. As of 0.8.8, limit is not checked at runtime.- Parameters:
context- unused; kept so callers can build this from a context without consulting LogManager themselves
LogConsoleBuffer
public LogConsoleBuffer(int limit) In theory the limit is configurable, but it isn't in the UI, so set it at construction.- Parameters:
limit- max size of each buffer
Method Details
add
Add a message to the buffer.- Parameters:
msg- the already-formatted log line, added without escaping
addCritical
Only adds to the critical buffer, not to both.- Parameters:
msg- the already-formatted log line, added without escaping
getMostRecentMessages
getMostRecentCriticalMessages
getUIMessages
Retrieve the currently buffered messages, earlier values were generated... earlier. All values are strings with no formatting (as they are written in the logs).- Returns:
- the buffer itself, oldest first, for incremental reads by the UI
getCriticalUIMessages
Retrieve the currently buffered critical messages, earlier values were generated... earlier. All values are strings with no formatting (as they are written in the logs).- Returns:
- the critical buffer itself, oldest first, for incremental reads
clear
public void clear()Clear all log entries from the buffer.