[TASK] Convert log levels from string to integer
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Classes / Log / LogLevel.php
index ac6e08a..35c9147 100644 (file)
@@ -147,6 +147,20 @@ class LogLevel {
                }
        }
 
+       /**
+        * Normalizes level by converting it from string to integer
+        *
+        * @param string $level
+        * @return integer|string
+        */
+       static public function normalizeLevel($level) {
+               if (is_string($level) && defined(__CLASS__ . '::' . strtoupper($level))) {
+                       $level = constant(__CLASS__ . '::' . strtoupper($level));
+               }
+
+               return $level;
+       }
+
 }