Class Logger

java.lang.Object
ai.attackframework.tools.burp.utils.Logger

public final class Logger extends Object
Centralizes extension logging for SLF4J, Burp, and Swing listeners.

This helper writes to SLF4J, mirrors selected messages to Burp's logging APIs when available, and exposes a listener bus used by the Log panel and tests.

A bounded replay buffer lets newly registered listeners reconstruct recent history after UI removal or recreation. Listener callbacks are always delivered on the EDT.

  • Method Details

    • initialize

      public static void initialize(burp.api.montoya.logging.Logging montoyaLogging)
      Wires Burp's logging sink.
      Parameters:
      montoyaLogging - Burp logging handle
    • registerListener

      public static void registerListener(Logger.LogListener listener)
      Registers a UI/log listener. If the listener is a Logger.ReplayableLogListener, recent buffered messages are replayed so the panel shows full history (e.g. after switching back to the extension tab when Burp had removed the panel).
      Parameters:
      listener - listener to add (nullable ignored)
    • unregisterListener

      public static void unregisterListener(Logger.LogListener listener)
      Unregisters a UI/log listener.
      Parameters:
      listener - listener to remove (nullable ignored)
    • resetState

      public static void resetState()
      Clears listener registrations, replay state, and the Montoya logging sink.

      Intended for extension unload and test isolation so stale listeners do not survive a reload or leak state across tests.

    • logInfo

      public static void logInfo(String msg)
      Logs at INFO and mirrors to Burp and UI listeners.
      Parameters:
      msg - message to log
    • logInfoPanelOnly

      public static void logInfoPanelOnly(String msg)
      Logs at INFO to SLF4J and UI listeners only; does not send to Burp extension Output. Use for high-signal messages that should appear in the extension's Log tab but not in Burp's Extensions → Output console (e.g. "Creating index for: X", "Result for X: CREATED").
      Parameters:
      msg - message to log
    • logWarnPanelOnly

      public static void logWarnPanelOnly(String msg)
      Logs at WARN to SLF4J and UI listeners only; does not send to Burp's output/error consoles.

      Use for recoverable degradation or operator-visible warning conditions that should be easy to spot in the extension Log tab without adding noise to Burp's global console.

      Parameters:
      msg - message to log
    • logErrorPanelOnly

      public static void logErrorPanelOnly(String msg)
      Logs at ERROR to SLF4J and UI listeners only; does not send to Burp's error console.
      Parameters:
      msg - message to log
    • logWarn

      public static void logWarn(String msg)
      Logs at WARN and mirrors to Burp and UI listeners.
      Parameters:
      msg - message to log
    • logDebug

      public static void logDebug(String msg)
      Logs at DEBUG (when enabled) and mirrors to UI listeners only (not Burp console).
      Parameters:
      msg - message to log
    • logTrace

      public static void logTrace(String msg)
      Logs at TRACE (when enabled) and mirrors to UI listeners only (not Burp console).
      Parameters:
      msg - message to log
    • logError

      public static void logError(String msg)
      Logs at ERROR and mirrors to Burp and UI listeners.
      Parameters:
      msg - message to log
    • logError

      public static void logError(String msg, Throwable t)
      Logs at ERROR with throwable, mirrors concise summary to Burp/UI listeners.
      Parameters:
      msg - message to log
      t - throwable (nullable)
    • emitToListeners

      public static void emitToListeners(String level, String message)
      Allows logging backends to forward events into the UI listener bus.
      Parameters:
      level - level string
      message - message to emit
    • internalInfo

      public static void internalInfo(String msg)
      Logs at INFO without notifying UI listeners.
    • internalWarn

      public static void internalWarn(String msg)
      Logs at WARN without notifying UI listeners.
    • internalDebug

      public static void internalDebug(String msg)
      Logs at DEBUG without notifying UI listeners.
    • internalTrace

      public static void internalTrace(String msg)
      Logs at TRACE without notifying UI listeners.
    • isInternalDebugEnabled

      public static boolean isInternalDebugEnabled()
      Returns whether DEBUG-level internal logging is enabled. Hot paths can use this to skip message-string concatenation entirely when the level is disabled.
    • isInternalTraceEnabled

      public static boolean isInternalTraceEnabled()
      Returns whether TRACE-level internal logging is enabled. Hot paths can use this to skip message-string concatenation entirely when the level is disabled.