Class ThemedLogger
java.lang.Object
com.tnsai.quality.observability.theme.ThemedLogger
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 Summary
Modifier and TypeMethodDescriptionvoidactionComplete(String message) Logs action completion.voidactionError(String message) Logs action error.voidactionError(String message, Throwable t) Logs action error with exception.voidactionStart(String message) Logs action start.voidLogs agent idle state.voidagentStart(String message) Logs agent start.voidLogs agent stop.voidbeliefUpdate(String message) Logs belief update.static ThemedLoggerCreates a themed logger with default theme.static ThemedLoggerCreates a themed logger.voidLogs debug message.voidLogs error message.voidLogs error with exception.voidLogs failure message.static ThemedLoggerCreates a themed logger for a class.Gets the context name.getTheme()Gets the current theme.voidgoalAchieved(String message) Logs goal achievement.voidgoalFailed(String message) Logs goal failure.voidLogs info message.booleanChecks if debug logging is enabled.voidLogs LLM call.voidLogs LLM error.voidLogs LLM error with exception.voidllmResponse(String message) Logs LLM response.voidLogs shutdown message if theme has one.voidLogs startup message if theme has one.voidmessageReceived(String message) Logs message received.voidmessageSent(String message) Logs message sent.voidplanComplete(String message) Logs plan completion.voidLogs plan start.Sets the theme.voidstateChange(String message) Logs state change.voidLogs success message.voidLogs tool call.voidLogs warning message.voidLogs warning with exception.
-
Method Details
-
create
Creates a themed logger.- Parameters:
context- the logging context (e.g., agent ID)theme- the log theme- Returns:
- a new themed logger
-
create
Creates a themed logger with default theme.- Parameters:
context- the logging context- Returns:
- a new themed logger
-
forClass
Creates a themed logger for a class.- Parameters:
clazz- the class for logger namingtheme- the log theme- Returns:
- a new themed logger
-
setTheme
Sets the theme.- Parameters:
theme- the new theme- Returns:
- this logger for chaining
-
getTheme
Gets the current theme.- Returns:
- current theme
-
agentStart
Logs agent start. -
agentStop
Logs agent stop. -
agentIdle
Logs agent idle state. -
actionStart
Logs action start. -
actionComplete
Logs action completion. -
actionError
Logs action error. -
actionError
Logs action error with exception. -
planStart
Logs plan start. -
planComplete
Logs plan completion. -
goalAchieved
Logs goal achievement. -
goalFailed
Logs goal failure. -
llmCall
Logs LLM call. -
llmResponse
Logs LLM response. -
llmError
Logs LLM error. -
llmError
Logs LLM error with exception. -
toolCall
Logs tool call. -
messageSent
Logs message sent. -
messageReceived
Logs message received. -
stateChange
Logs state change. -
beliefUpdate
Logs belief update. -
info
Logs info message. -
debug
Logs debug message. -
warn
Logs warning message. -
warn
Logs warning with exception. -
error
Logs error message. -
error
Logs error with exception. -
success
Logs success message. -
failure
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
Gets the context name.- Returns:
- context
-
isDebugEnabled
public boolean isDebugEnabled()Checks if debug logging is enabled.- Returns:
- true if debug is enabled
-