Procházet zdrojové kódy

Merge pull request #1507 from adrianpanicek/master

Allow string numeric log levels
Jordi Boggiano před 5 roky
rodič
revize
6165cdc115
1 změnil soubory, kde provedl 4 přidání a 0 odebrání
  1. 4 0
      src/Monolog/Logger.php

+ 4 - 0
src/Monolog/Logger.php

@@ -410,6 +410,10 @@ class Logger implements LoggerInterface, ResettableInterface
     public static function toMonologLevel($level): int
     {
         if (is_string($level)) {
+            if (is_numeric($level)) {
+                return intval($level);
+            }
+            
             // 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)
             $upper = strtr($level, 'abcdefgilmnortuwy', 'ABCDEFGILMNORTUWY');