Class LogRenderer

java.lang.Object
ai.attackframework.tools.burp.ui.log.LogRenderer

public final class LogRenderer extends Object
Renderer: writes/replaces lines in the document, formats output, and autoscrolls. Uses plain text (no per-level styling) so the log can use JTextArea with line wrap.

Threading: expected on the EDT.

  • Constructor Details

    • LogRenderer

      public LogRenderer(JTextComponent textComponent)
      Creates a renderer bound to the provided text component (e.g. JTextArea for line wrap).

      Caller must construct on the EDT.

      Parameters:
      textComponent - target component to render into (must have an AbstractDocument)
  • Method Details

    • clear

      public void clear()
      Clears all rendered content and resets internal cursor state.

      EDT only.

    • append

      public void append(String line, LogStore.Level level)
      Appends a formatted line to the document.
      Parameters:
      line - text to append (should include trailing newline)
      level - log level (unused; kept for API compatibility)
    • replaceLast

      public void replaceLast(String line, LogStore.Level level)
      Replaces the most recently written line, preserving cursor bookkeeping.
      Parameters:
      line - replacement text (should include trailing newline)
      level - log level (unused; kept for API compatibility)
    • autoscrollIfNeeded

      public void autoscrollIfNeeded(boolean paused)
      Scrolls to the bottom unless paused.
    • formatLine

      public String formatLine(LocalDateTime ts, LogStore.Level lvl, String msg, int repeats)
      Formats a log entry into a single rendered line.

      Parameters:
      ts - timestamp (fallbacks to now when null)
      lvl - log level
      msg - log message (nullable)
      repeats - duplicate count; >1 renders as (xN)
      Returns:
      formatted line including trailing newline