<?php
 namespace App\Logging; use Monolog\LogRecord; use Monolog\Processor\ProcessorInterface; final class SensitiveContextProcessor implements ProcessorInterface { public function __invoke(LogRecord $record): LogRecord { if (empty($record->context)) { return $record; } $redactedContext = SensitiveDataRedactor::redact($record->context); if ($redactedContext === $record->context) { return $record; } return $record->with(context: $redactedContext); } } 