1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-02-23 22:42:38 +01:00

getLevelName needs to be called earlier, so it can still thrown

exceptions for invalid levels even without a handler
This commit is contained in:
Edson Medina 2014-12-02 23:51:28 +00:00
parent 38f8dc52de
commit ae68665460

View File

@ -229,6 +229,8 @@ class Logger implements LoggerInterface
$this->pushHandler(new StreamHandler('php://stderr', static::DEBUG));
}
$levelName = static::getLevelName($level);
// check if any handler will handle this message
$handlerKey = null;
foreach ($this->handlers as $key => $handler) {
@ -250,7 +252,7 @@ class Logger implements LoggerInterface
'message' => (string) $message,
'context' => $context,
'level' => $level,
'level_name' => static::getLevelName($level),
'level_name' => $levelName,
'channel' => $this->name,
'datetime' => \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)), static::$timezone)->setTimezone(static::$timezone),
'extra' => array(),