mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-06 05:07:36 +02:00
Allow string numeric log levels
This commit is contained in:
@@ -410,6 +410,10 @@ 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 (is_numeric($level)) {
|
||||||
|
return intval($level);
|
||||||
|
}
|
||||||
|
|
||||||
// Contains chars of all log levels and avoids using strtoupper() which may have
|
// Contains chars of all log levels and avoids using strtoupper() which may have
|
||||||
// strange results depending on locale (for example, "i" will become "İ" in Turkish locale)
|
// strange results depending on locale (for example, "i" will become "İ" in Turkish locale)
|
||||||
$upper = strtr($level, 'abcdefgilmnortuwy', 'ABCDEFGILMNORTUWY');
|
$upper = strtr($level, 'abcdefgilmnortuwy', 'ABCDEFGILMNORTUWY');
|
||||||
|
Reference in New Issue
Block a user