Severity : int
Log severity levels aligned with OpenTelemetry ranges.
Severity indicates the importance and urgency of a log record. These levels align with OpenTelemetry's severity number ranges, enabling proper translation to OTEL protocol.
Example usage:
$logger->emit(Severity::INFO, 'Processing started');
// Check severity level
if ($severity->isAtLeast(Severity::WARN)) {
// Handle warning or higher
}
Cases
- DEBUG = 5
- Debugging information.
- ERROR = 17
- Error messages.
- FATAL = 21
- Fatal/critical messages.
- INFO = 9
- Informational messages.
- TRACE = 1
- Finest-grained debugging information.
- WARN = 13
- Warning messages.
Methods
- isAtLeast() : bool
- Check if this severity is at least as severe as another.
- name() : string
- Get the severity name as a string.
Cases
DEBUG
Debugging information.
Use for diagnostic information useful during development and debugging sessions. OTEL severity range: 5-8
ERROR
Error messages.
Use when an error occurred but the application can continue running. OTEL severity range: 17-20
FATAL
Fatal/critical messages.
Use for severe errors that will likely cause the application to terminate or become unusable. OTEL severity range: 21-24
INFO
Informational messages.
Use for general operational information about the application's normal behavior. OTEL severity range: 9-12
TRACE
Finest-grained debugging information.
Use for very detailed diagnostic information, typically only enabled during development or troubleshooting. OTEL severity range: 1-4
WARN
Warning messages.
Use for potentially harmful situations that don't prevent the application from functioning. OTEL severity range: 13-16
Methods
isAtLeast()
Check if this severity is at least as severe as another.
public
isAtLeast(Severity $other) : bool
This is useful for filtering logs by minimum severity level.
Parameters
- $other : Severity
-
The severity to compare against
Return values
bool —True if this severity is greater than or equal to $other
name()
Get the severity name as a string.
public
name() : string
Return values
string —The severity level name (TRACE, DEBUG, INFO, WARN, ERROR, FATAL)