Class ThemedLogger

java.lang.Object
com.tnsai.quality.observability.theme.ThemedLogger

public final class ThemedLogger extends Object
Logger wrapper that applies themed formatting to messages.

ThemedLogger wraps SLF4J and adds fun, themed prefixes to log messages based on the event type.

Usage


 // Create with theme
 ThemedLogger logger = ThemedLogger.create("my-agent", LogThemes.STAR_WARS);

 // Log events
 logger.actionStart("Searching for documents");
 // Output: [LIGHTSABER ON] Searching for documents

 logger.actionComplete("Found 5 documents");
 // Output: [THE FORCE SUCCEEDS] Found 5 documents

 logger.error("Connection failed");
 // Output: [SITH LORD DETECTED] Connection failed
 

Configuration


 // Change theme at runtime
 logger.setTheme(LogThemes.LOTR);

 // Disable theming temporarily
 logger.setTheme(LogThemes.DEFAULT);
 
Author:
TnsAI Team
See Also:
  • Method Details

    • create

      public static ThemedLogger create(String context, LogTheme theme)
      Creates a themed logger.
      Parameters:
      context - the logging context (e.g., agent ID)
      theme - the log theme
      Returns:
      a new themed logger
    • create

      public static ThemedLogger create(String context)
      Creates a themed logger with default theme.
      Parameters:
      context - the logging context
      Returns:
      a new themed logger
    • forClass

      public static ThemedLogger forClass(Class<?> clazz, LogTheme theme)
      Creates a themed logger for a class.
      Parameters:
      clazz - the class for logger naming
      theme - the log theme
      Returns:
      a new themed logger
    • setTheme

      public ThemedLogger setTheme(LogTheme theme)
      Sets the theme.
      Parameters:
      theme - the new theme
      Returns:
      this logger for chaining
    • getTheme

      public LogTheme getTheme()
      Gets the current theme.
      Returns:
      current theme
    • agentStart

      public void agentStart(String message)
      Logs agent start.
    • agentStop

      public void agentStop(String message)
      Logs agent stop.
    • agentIdle

      public void agentIdle(String message)
      Logs agent idle state.
    • actionStart

      public void actionStart(String message)
      Logs action start.
    • actionComplete

      public void actionComplete(String message)
      Logs action completion.
    • actionError

      public void actionError(String message)
      Logs action error.
    • actionError

      public void actionError(String message, Throwable t)
      Logs action error with exception.
    • planStart

      public void planStart(String message)
      Logs plan start.
    • planComplete

      public void planComplete(String message)
      Logs plan completion.
    • goalAchieved

      public void goalAchieved(String message)
      Logs goal achievement.
    • goalFailed

      public void goalFailed(String message)
      Logs goal failure.
    • llmCall

      public void llmCall(String message)
      Logs LLM call.
    • llmResponse

      public void llmResponse(String message)
      Logs LLM response.
    • llmError

      public void llmError(String message)
      Logs LLM error.
    • llmError

      public void llmError(String message, Throwable t)
      Logs LLM error with exception.
    • toolCall

      public void toolCall(String message)
      Logs tool call.
    • messageSent

      public void messageSent(String message)
      Logs message sent.
    • messageReceived

      public void messageReceived(String message)
      Logs message received.
    • stateChange

      public void stateChange(String message)
      Logs state change.
    • beliefUpdate

      public void beliefUpdate(String message)
      Logs belief update.
    • info

      public void info(String message)
      Logs info message.
    • debug

      public void debug(String message)
      Logs debug message.
    • warn

      public void warn(String message)
      Logs warning message.
    • warn

      public void warn(String message, Throwable t)
      Logs warning with exception.
    • error

      public void error(String message)
      Logs error message.
    • error

      public void error(String message, Throwable t)
      Logs error with exception.
    • success

      public void success(String message)
      Logs success message.
    • failure

      public void failure(String message)
      Logs failure message.
    • logStartup

      public void logStartup()
      Logs startup message if theme has one.
    • logShutdown

      public void logShutdown()
      Logs shutdown message if theme has one.
    • getContext

      public String getContext()
      Gets the context name.
      Returns:
      context
    • isDebugEnabled

      public boolean isDebugEnabled()
      Checks if debug logging is enabled.
      Returns:
      true if debug is enabled