Class ExecutionLogger
java.lang.Object
ai.nervemind.app.service.ExecutionLogger
Structured logging service for workflow execution.
Provides JSON-formatted log entries with context and timing.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordExecution summary record.static enumCategories for log entries.static final recordLog entry record.static enumLog levels for execution logging. -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new ExecutionLogger and initializes the JSON mapper. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddHandler(ai.nervemind.common.service.ExecutionLogHandler handler) Add a log handler.voidclearAll()Clear all logs.voidclearExecution(String executionId) Clear logs for an execution.voidcustom(String executionId, ExecutionLogger.LogLevel level, String message, Map<String, Object> context) Custom log entry.voidLog data flow between nodes.voidendExecution(String executionId, boolean success, Object result) End logging for an execution.voidLog error with full details including input context and source location.voiderrorWithContext(String executionId, String nodeId, String nodeName, Map<String, Object> inputAtError, Exception e) Log error with full details including input context and source location.voidexportToFile(String executionId, Path filePath) Export logs to a file.exportToJson(String executionId) Export logs to JSON.voidexpressionEval(String executionId, String nodeId, String expression, Object result, boolean success) Log expression evaluation for debugging templating and interpolation.getLogEntries(String executionId) Get all log entries for an execution.getLogEntries(String executionId, ExecutionLogger.LogLevel minLevel, ExecutionLogger.LogCategory category) Get filtered log entries.getSummary(String executionId) Get execution summary.voidLog node execution end.voidLog node input data for traceability.voidLog node output data for traceability.voidLog node skip (conditional).voidLog node execution start.voidperformance(String executionId, String metric, long value, String unit) Log performance metric.voidLog rate limiting event.voidremoveHandler(ai.nervemind.common.service.ExecutionLogHandler handler) Remove a log handler.voidLog retry attempt.voidstartExecution(String executionId, String workflowId, String workflowName) Start logging for an execution.voidLog variable operation.
-
Constructor Details
-
ExecutionLogger
public ExecutionLogger()Constructs a new ExecutionLogger and initializes the JSON mapper.
-
-
Method Details
-
startExecution
-
endExecution
-
nodeStart
-
nodeEnd
public void nodeEnd(String executionId, String nodeId, String nodeType, long durationMs, boolean success) Log node execution end.- Parameters:
executionId- the execution IDnodeId- the node IDnodeType- the node typedurationMs- execution duration in millisecondssuccess- true if node execution succeeded
-
nodeSkip
-
dataFlow
-
variable
-
nodeInput
-
nodeOutput
-
expressionEval
public void expressionEval(String executionId, String nodeId, String expression, Object result, boolean success) Log expression evaluation for debugging templating and interpolation.- Parameters:
executionId- the execution IDnodeId- the node IDexpression- the expression that was evaluatedresult- the evaluation resultsuccess- true if evaluation succeeded
-
error
-
errorWithContext
public void errorWithContext(String executionId, String nodeId, String nodeName, Map<String, Object> inputAtError, Exception e) Log error with full details including input context and source location. Enhanced version that captures the input data at the time of error.- Parameters:
executionId- the execution IDnodeId- the node IDnodeName- the node name (optional)inputAtError- the input data at the time of error (optional)e- the exception that occurred
-
retry
public void retry(String executionId, String nodeId, int attempt, int maxRetries, long delayMs, String reason) Log retry attempt.- Parameters:
executionId- the execution IDnodeId- the node IDattempt- the current attempt numbermaxRetries- the maximum number of retriesdelayMs- the delay before next attemptreason- the reason for retry
-
rateLimit
-
performance
-
custom
-
getLogEntries
Get all log entries for an execution.- Parameters:
executionId- the execution ID- Returns:
- list of log entries
-
getLogEntries
public List<ExecutionLogger.LogEntry> getLogEntries(String executionId, ExecutionLogger.LogLevel minLevel, ExecutionLogger.LogCategory category) Get filtered log entries.- Parameters:
executionId- the execution IDminLevel- minimum log levelcategory- log category- Returns:
- list of filtered log entries
-
getSummary
Get execution summary.- Parameters:
executionId- the execution ID- Returns:
- the execution summary, or null if not found
-
exportToJson
-
exportToFile
Export logs to a file.- Parameters:
executionId- the execution IDfilePath- the destination file path- Throws:
IOException- if file writing fails
-
addHandler
public void addHandler(ai.nervemind.common.service.ExecutionLogHandler handler) Add a log handler.- Parameters:
handler- the log handler to add
-
removeHandler
public void removeHandler(ai.nervemind.common.service.ExecutionLogHandler handler) Remove a log handler.- Parameters:
handler- the log handler to remove
-
clearExecution
Clear logs for an execution.- Parameters:
executionId- the execution ID to clear
-
clearAll
public void clearAll()Clear all logs.
-