mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-09 06:36:46 +02:00
Merge branch '1.x'
This commit is contained in:
@@ -408,8 +408,11 @@ class Logger implements LoggerInterface, ResettableInterface
|
|||||||
public static function toMonologLevel($level): int
|
public static function toMonologLevel($level): int
|
||||||
{
|
{
|
||||||
if (is_string($level)) {
|
if (is_string($level)) {
|
||||||
if (defined(__CLASS__.'::'.strtoupper($level))) {
|
// Contains chars of all log levels and avoids using strtoupper() which may have
|
||||||
return constant(__CLASS__.'::'.strtoupper($level));
|
// strange results depending on locale (for example, "i" will become "İ" in Turkish locale)
|
||||||
|
$upper = strtr($level, 'abcdefgilmnortuwy', 'ABCDEFGILMNORTUWY');
|
||||||
|
if (defined(__CLASS__.'::'.$upper)) {
|
||||||
|
return constant(__CLASS__ . '::' . $upper);
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new InvalidArgumentException('Level "'.$level.'" is not defined, use one of: '.implode(', ', array_keys(static::$levels)));
|
throw new InvalidArgumentException('Level "'.$level.'" is not defined, use one of: '.implode(', ', array_keys(static::$levels)));
|
||||||
|
Reference in New Issue
Block a user