1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-10-22 00:56:08 +02:00

Throw an exception on invalid level name

This commit is contained in:
Jordi Boggiano
2012-11-14 16:46:10 +01:00
parent bcb51e0140
commit b23cfd3d6c
2 changed files with 21 additions and 0 deletions

View File

@@ -322,6 +322,10 @@ class Logger
*/
public static function getLevelName($level)
{
if (!isset(static::$levels[$level])) {
throw new \InvalidArgumentException('Level "'.$level.'" is not defined, use one of: '.implode(', ', array_keys(static::$levels)));
}
return static::$levels[$level];
}