Package eu.svjatoslav.sixth.e3d.gui
Class DebugLogBuffer
java.lang.Object
eu.svjatoslav.sixth.e3d.gui.DebugLogBuffer
Circular buffer for debug log messages with optional stdout passthrough.
Always captures log messages to a fixed-size circular buffer.
When passthrough is enabled, messages are also printed to stdout.
This allows capturing early initialization logs before the user opens
the DeveloperToolsPanel. When the panel is opened, the buffered history
becomes immediately visible.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDebugLogBuffer(int capacity) Creates a new DebugLogBuffer with the specified capacity. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears all buffered log entries.Returns all buffered log entries in chronological order.booleanReturns whether passthrough to stdout is enabled.voidLogs a message with a timestamp prefix.voidsetPassthrough(boolean passthrough) Enables or disables passthrough to stdout.intsize()Returns the current number of log entries in the buffer.
-
Constructor Details
-
DebugLogBuffer
public DebugLogBuffer(int capacity) Creates a new DebugLogBuffer with the specified capacity.- Parameters:
capacity- the maximum number of log entries to retain
-
-
Method Details
-
log
Logs a message with a timestamp prefix.If passthrough is enabled, also prints to stdout.
- Parameters:
message- the message to log
-
getEntries
Returns all buffered log entries in chronological order.- Returns:
- a list of timestamped log entries
-
clear
public void clear()Clears all buffered log entries. -
isPassthrough
public boolean isPassthrough()Returns whether passthrough to stdout is enabled.- Returns:
trueif logs are also printed to stdout
-
setPassthrough
public void setPassthrough(boolean passthrough) Enables or disables passthrough to stdout.When enabled, all subsequent log messages will be printed to stdout in addition to being captured in the buffer.
- Parameters:
passthrough-trueto enable passthrough
-
size
public int size()Returns the current number of log entries in the buffer.- Returns:
- the number of entries
-