SeverityMapper
Read onlyYes
FinalYes
Maps Monolog log levels to Flow Telemetry severity levels.
Provides a configurable mapping from Monolog's 8 levels to Telemetry's 6 severity levels. By default:
- DEBUG → DEBUG
- INFO, NOTICE → INFO
- WARNING → WARN
- ERROR → ERROR
- CRITICAL, ALERT, EMERGENCY → FATAL
Custom mappings can be provided to override the defaults.
Example with custom mapping:
$mapper = new SeverityMapper([
Level::Notice->value => Severity::WARN, // Override: NOTICE → WARN instead of INFO
]);
Methods
- __construct() : mixed
- defaultMapping() : array<int, Severity>
- Get the default mapping from Monolog levels to Telemetry severity.
- map() : Severity
- Map a Monolog Level to a Telemetry Severity.
Methods
__construct()
public
__construct([null|array<int, Severity> $customMapping = null ]) : mixed
Parameters
- $customMapping : null|array<int, Severity> = null
-
Optional custom mapping (Monolog Level value => Telemetry Severity)
defaultMapping()
Get the default mapping from Monolog levels to Telemetry severity.
public
static defaultMapping() : array<int, Severity>
Return values
array<int, Severity>map()
Map a Monolog Level to a Telemetry Severity.
public
map(Level $level) : Severity
Parameters
- $level : Level
-
The Monolog log level
Tags
Return values
Severity —The corresponding Telemetry severity