{
"event": "PreToolUse",
"tool_name": "Read",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/Logging\/AuditLogger.php",
"limit": 50
}
}
{
"tool_response": {
"type": "text",
"file": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Infrastructure\/Logging\/AuditLogger.php",
"content": "<?php\n\ndeclare(strict_types=1);\n\nnamespace Infrastructure\\Logging;\n\n\/\/ @responsibility: Audit-Logging mit Correlation-ID und strukturiertem Kontext\n\nuse PDO;\n\nfinal class AuditLogger\n{\n private string $correlationId;\n private PDO $db;\n\n private const LOG_LEVELS = ['debug', 'info', 'warning', 'error'];\n\n public function __construct(PDO $pdo, ?string $correlationId = null)\n {\n $this->db = $pdo;\n $this->correlationId = $correlationId\n ?? $_SERVER['HTTP_X_CORRELATION_ID']\n ?? $_SERVER['CORRELATION_ID']\n ?? $this->generateCorrelationId();\n }\n\n \/**\n * Generate a unique correlation ID.\n *\/\n private function generateCorrelationId(): string\n {\n return bin2hex(random_bytes(8));\n }\n\n \/**\n * Get the current correlation ID.\n *\/\n public function getCorrelationId(): string\n {\n return $this->correlationId;\n }\n\n \/**\n * Log a generic event.\n *\n * @param string $event Event name (e.g., \"user.login\", \"chat.message.sent\")\n * @param array<string, mixed> $context Additional context data\n * @param string $level Log level: debug, info, warning, error\n *\/\n public function log(string $event, array $context = [], string $level = 'info'): void",
"numLines": 50,
"startLine": 1,
"totalLines": 190
}
}
}