Flow PHP

EnrichingLogMiddleware implements LogMiddleware

Read onlyYes
FinalYes

Merges a fixed set of attributes into every log entry that passes through.

The configured attributes act as defaults: an attribute already present on the record (set at the call site) wins over the enricher of the same key. Because LogEntry and LogRecord are immutable, enrichment returns a new entry carrying a new record - this is the spec-endorsed "modify the log record" step of a LogRecordProcessor, modelled immutably.

Interfaces

LogMiddleware
A chainable log-processing step inside a {@see Processor\PipelineLogProcessor}.

Methods

__construct()  : mixed
process()  : LogEntry|null
Transform or filter a log entry.

Methods

__construct()

public __construct(array<string, array<string|int, mixed>|bool|DateTimeInterface|float|int|string|Throwable>|Attributes $attributes) : mixed
Parameters
$attributes : array<string, array<string|int, mixed>|bool|DateTimeInterface|float|int|string|Throwable>|Attributes

process()

Transform or filter a log entry.

public process(LogEntry $entry) : LogEntry|null

Return the entry to pass to the next step (the same instance, or a new one carrying enriched attributes), or null to drop it - dropping short-circuits the rest of the pipeline and the entry is never exported.

Parameters
$entry : LogEntry
Return values
LogEntry|null
On this page

Search results