LogRecordConverter
Read onlyYes
FinalYes
Convert a PSR-3 log call (level + message + context) into a Telemetry LogRecord.
Behavior:
- Severity mapped via SeverityMapper.
- Message body has
{placeholder}tokens substituted from context per PSR-3 §1.2. Only scalars and Stringable objects participate in interpolation; arrays, Throwables, and objects without __toString are left in the template. - Every context entry is recorded as an attribute under its raw key.
- A
Throwableunder theexceptionkey is routed through LogRecord::setException() (populates exception.type/message/stacktrace) and NOT also recorded under theexceptionattribute.
Methods
- __construct() : mixed
- convert() : LogRecord
Methods
__construct()
public
__construct([SeverityMapper $severityMapper = new SeverityMapper() ][, ValueNormalizer $valueNormalizer = new ValueNormalizer() ]) : mixed
Parameters
- $severityMapper : SeverityMapper = new SeverityMapper()
- $valueNormalizer : ValueNormalizer = new ValueNormalizer()
convert()
public
convert(string|Stringable $level, string|Stringable $message[, array<string|int, mixed> $context = [] ]) : LogRecord
Parameters
- $level : string|Stringable
- $message : string|Stringable
- $context : array<string|int, mixed> = []