MemoryLogProcessor implements LogProcessor
FinalYes
Processor that stores log entries in memory and exports via configured exporter.
Interfaces
- LogProcessor
- Interface for processing log records.
Methods
- __construct() : mixed
- countLogs() : int
- Get the total number of recorded log entries.
- entries() : array<string|int, LogEntry>
- Get all recorded log entries.
- entriesContaining() : array<string|int, LogEntry>
- Filter log entries by body substring.
- entriesWithSeverity() : array<string|int, LogEntry>
- Filter log entries by severity.
- exporter() : LogExporter
- Get the exporter used by this processor.
- flush() : bool
- Export all pending log records.
- process() : void
- Process a log entry.
- reset() : void
- Reset all stored data.
Methods
__construct()
public
__construct(LogExporter $logExporter) : mixed
Parameters
- $logExporter : LogExporter
countLogs()
Get the total number of recorded log entries.
public
countLogs() : int
Return values
intentries()
Get all recorded log entries.
public
entries() : array<string|int, LogEntry>
Return values
array<string|int, LogEntry>entriesContaining()
Filter log entries by body substring.
public
entriesContaining(string $substring) : array<string|int, LogEntry>
Parameters
- $substring : string
Return values
array<string|int, LogEntry>entriesWithSeverity()
Filter log entries by severity.
public
entriesWithSeverity(Severity $severity) : array<string|int, LogEntry>
Parameters
- $severity : Severity
Return values
array<string|int, LogEntry>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
reset()
Reset all stored data.
public
reset() : void