LoggerLevel
in package
A helper class for CoreLogger that defines how a CoreLogger log level corresponds to a PHP error code.
Tags
Table of Contents
Properties
- $errorCodeMap : array<int, int>
- $logLevelMap : array<string, int>
Methods
- getInternalLogLevel() : int
- Returns the matching Pipit log level for a given PSR Log level
- getMaxInternalLevel() : int
- Returns the maximum Pipit log level
- getPhpErrorCodeByInternalLevel() : int
- Returns the matching PHP error code for a given Pipit log level
Properties
$errorCodeMap
private
static array<int, int>
$errorCodeMap
= [1 => E_USER_NOTICE, 2 => E_USER_WARNING, 3 => E_USER_ERROR]
Maps Pipit levels to PHP error codes
$logLevelMap
private
static array<string, int>
$logLevelMap
= [\Psr\Log\LogLevel::EMERGENCY => 3, \Psr\Log\LogLevel::ALERT => 3, \Psr\Log\LogLevel::CRITICAL => 3, \Psr\Log\LogLevel::ERROR => 3, \Psr\Log\LogLevel::WARNING => 2, \Psr\Log\LogLevel::NOTICE => 1, \Psr\Log\LogLevel::INFO => 1, \Psr\Log\LogLevel::DEBUG => 1]
Maps PSR LogLevels to Pipit log levels
Methods
getInternalLogLevel()
Returns the matching Pipit log level for a given PSR Log level
public
static getInternalLogLevel(string $psrLevel) : int
Parameters
- $psrLevel : string
-
The PSR level
Return values
int —The Pipit level
getMaxInternalLevel()
Returns the maximum Pipit log level
public
static getMaxInternalLevel() : int
Return values
int —The max Pipit level
getPhpErrorCodeByInternalLevel()
Returns the matching PHP error code for a given Pipit log level
public
static getPhpErrorCodeByInternalLevel(int $internalLevel) : int
Parameters
- $internalLevel : int
-
The Pipit log level
Return values
int —The PHP error code