ToolAuditLogger
Audit logger for tool calls. Logs all tool executions for security and debugging.
ToolAuditLogger::__construct()
public function __construct(Psr\Log\LoggerInterface $logger):Parameters
| Name | Type | Description |
|---|---|---|
| $logger | Psr\Log\LoggerInterface |
ToolAuditLogger::log()
public function log(Milpa\ToolRuntime\Contracts\ToolContext $ctx, string $tool, array $args, bool $ok, ?string $errorCode, int $took_ms, ?int $outputSize = null): voidLog a tool call.
Parameters
| Name | Type | Description |
|---|---|---|
| $ctx | Milpa\ToolRuntime\Contracts\ToolContext | |
| $tool | string | |
| $args | array<string, mixed> | |
| $ok | bool | |
| $errorCode | ?string | |
| $took_ms | int | |
| $outputSize | ?int |
ToolAuditLogger::logAuthFailure()
public function logAuthFailure(Milpa\ToolRuntime\Contracts\ToolContext $ctx, string $tool, string $reason): voidLog an authorization failure.
Parameters
| Name | Type | Description |
|---|---|---|
| $ctx | Milpa\ToolRuntime\Contracts\ToolContext | |
| $tool | string | |
| $reason | string |
ToolAuditLogger::logValidationFailure()
public function logValidationFailure(Milpa\ToolRuntime\Contracts\ToolContext $ctx, string $tool, array $errors): voidLog a validation failure.
Parameters
| Name | Type | Description |
|---|---|---|
| $ctx | Milpa\ToolRuntime\Contracts\ToolContext | |
| $tool | string | |
| $errors | list<string> |
ToolAuditLogger::addSensitiveField()
public function addSensitiveField(string $field): voidAdd a sensitive field to sanitize.
Parameters
| Name | Type | Description |
|---|---|---|
| $field | string |
ToolAuditLogger::logTimeout()
public function logTimeout(Milpa\ToolRuntime\Contracts\ToolContext $ctx, string $toolName, float $executionTime, int $timeoutLimit): voidLog a timeout exceeded warning. Called when a tool execution exceeds its configured timeout. This is a "soft" timeout - the result is still returned.
Parameters
| Name | Type | Description |
|---|---|---|
| $ctx | Milpa\ToolRuntime\Contracts\ToolContext | |
| $toolName | string | |
| $executionTime | float | |
| $timeoutLimit | int |