mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-24 10:06:08 +02: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:
@@ -229,6 +229,8 @@ class Logger implements LoggerInterface
|
|||||||
$this->pushHandler(new StreamHandler('php://stderr', static::DEBUG));
|
$this->pushHandler(new StreamHandler('php://stderr', static::DEBUG));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$levelName = static::getLevelName($level);
|
||||||
|
|
||||||
// check if any handler will handle this message
|
// check if any handler will handle this message
|
||||||
$handlerKey = null;
|
$handlerKey = null;
|
||||||
foreach ($this->handlers as $key => $handler) {
|
foreach ($this->handlers as $key => $handler) {
|
||||||
@@ -250,7 +252,7 @@ class Logger implements LoggerInterface
|
|||||||
'message' => (string) $message,
|
'message' => (string) $message,
|
||||||
'context' => $context,
|
'context' => $context,
|
||||||
'level' => $level,
|
'level' => $level,
|
||||||
'level_name' => static::getLevelName($level),
|
'level_name' => $levelName,
|
||||||
'channel' => $this->name,
|
'channel' => $this->name,
|
||||||
'datetime' => \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)), static::$timezone)->setTimezone(static::$timezone),
|
'datetime' => \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)), static::$timezone)->setTimezone(static::$timezone),
|
||||||
'extra' => array(),
|
'extra' => array(),
|
||||||
|
|||||||
Reference in New Issue
Block a user