<?php
namespace App\Logging;

use App\Support\Security\Redactor;
use Monolog\LogRecord;

final class RedactSensitiveContext
{
    public function __invoke(array $config): callable
    {
        return static function (LogRecord $record): LogRecord {
            return $record->with(context: Redactor::redact($record->context), extra: Redactor::redact($record->extra));
        };
    }
}
