Class ToolLogger
java.lang.Object
org.machanism.machai.process.provider.ToolLogger
Internal logging utility for tool inputs, results, and execution errors.
At info level, payloads are abbreviated to keep log output readable. At debug level, complete serialized payloads and failure stack traces are included.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDefines the types of operations whose activity can be logged. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final StringFormat used when a tool is invoked.(package private) static final StringFormat used when a tool invocation fails.(package private) static org.slf4j.LoggerLogger used to write tool execution messages.(package private) static final StringFormat used when a tool returns a result.private ToolLogger.TypeCategory assigned to messages emitted by this logger. -
Constructor Summary
ConstructorsConstructorDescriptionToolLogger(ToolLogger.Type type, FunctionTools tools) Creates an instance of ToolLogger. -
Method Summary
Modifier and TypeMethodDescriptionprivate Stringabbreviate(String valueOf) Abbreviates long log strings to keep logs concise and clean.voidLogs errors that occurred during tool method execution.voidLogs tool invocation input details.voidLogs tool invocation execution results.private StringwriteValueAsString(Object result) Utility method that safely serializes any payload object into a JSON string format.
-
Field Details
-
logger
static org.slf4j.Logger loggerLogger used to write tool execution messages. -
CALL_MSG
-
RETURNS_MSG
-
ERROR_MSG
-
type
Category assigned to messages emitted by this logger.
-
-
Constructor Details
-
ToolLogger
Creates an instance of ToolLogger.- Parameters:
type- category assigned to messages emitted by this loggertools- the tools instance creating this logger; retained for API compatibility
-
-
Method Details
-
logError
-
logInput
-
abbreviate
Abbreviates long log strings to keep logs concise and clean.- Parameters:
valueOf- the source string representation- Returns:
- the abbreviated string trimmed to
AbstractAIProvider.LOG_LINE_LENGcharacters
-
logResult
-
writeValueAsString
-