SeverityFilteringLogProcessor implements LogProcessor
Read onlyYes
FinalYes
Filters log entries based on minimum severity level.
This processor wraps another LogProcessor and only passes through log entries that are at or above the configured minimum severity level. Entries below the threshold are silently discarded.
Example usage:
// Only export WARN and above
$processor = new SeverityFilteringLogProcessor(
new BatchingLogProcessor($exporter, 100),
Severity::WARN,
);
Interfaces
- LogProcessor
- Interface for processing log records.
Methods
- __construct() : mixed
- exporter() : LogExporter
- Get the exporter used by this processor.
- flush() : bool
- Export all pending log records.
- process() : void
- Process a log entry.
Methods
__construct()
public
__construct(LogProcessor $processor, Severity $minimumSeverity) : mixed
Parameters
- $processor : LogProcessor
- $minimumSeverity : Severity
exporter()
Get the exporter used by this processor.
public
exporter() : LogExporter
Return values
LogExporterflush()
Export all pending log records.
public
flush() : bool
Forces immediate export of any buffered log records.
Return values
bool —True if all records were successfully exported
process()
Process a log entry.
public
process(LogEntry $entry) : void
This is invoked synchronously when a log is emitted. The processor may buffer the entry, export it immediately, or discard it based on filtering rules.
Parameters
- $entry : LogEntry
-
The complete log entry to process