Files
michaelschiemer/src/Framework/Logging/Handlers/NullHandler.php

31 lines
737 B
PHP

<?php
declare(strict_types=1);
namespace App\Framework\Logging\Handlers;
use App\Framework\Logging\LogHandler;
use App\Framework\Logging\LogRecord;
/**
* NullHandler discards all log entries without any output
*
* Use Cases:
* - MCP Server mode (prevents log interference with JSON-RPC)
* - Testing environments where logging should be suppressed
* - Performance-critical paths where logging overhead is unacceptable
*/
final readonly class NullHandler implements LogHandler
{
public function isHandling(LogRecord $record): bool
{
// Accept all levels but discard them
return true;
}
public function handle(LogRecord $record): void
{
// Discard all log entries - no output
}
}