Class DebugLogBuffer

java.lang.Object
eu.svjatoslav.sixth.e3d.gui.DebugLogBuffer

public class DebugLogBuffer extends Object
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

    Constructors
    Constructor
    Description
    DebugLogBuffer(int capacity)
    Creates a new DebugLogBuffer with the specified capacity.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clears all buffered log entries.
    Returns all buffered log entries in chronological order.
    boolean
    Returns whether passthrough to stdout is enabled.
    void
    log(String message)
    Logs a message with a timestamp prefix.
    void
    setPassthrough(boolean passthrough)
    Enables or disables passthrough to stdout.
    int
    Returns the current number of log entries in the buffer.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public void log(String message)
      Logs a message with a timestamp prefix.

      If passthrough is enabled, also prints to stdout.

      Parameters:
      message - the message to log
    • getEntries

      public List<String> 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:
      true if 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 - true to enable passthrough
    • size

      public int size()
      Returns the current number of log entries in the buffer.
      Returns:
      the number of entries