1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-05 04:37:38 +02:00

Move human readable level name resolution in Logger::addRecord() to as late as possible (#934)

This commit is contained in:
Ivan Kurnosov
2017-03-13 05:51:16 +13:00
committed by Jordi Boggiano
parent 7dd45ac6bf
commit f697ec7c96

View File

@@ -279,8 +279,6 @@ class Logger implements LoggerInterface
*/ */
public function addRecord(int $level, string $message, array $context = []): bool public function addRecord(int $level, string $message, array $context = []): bool
{ {
$levelName = static::getLevelName($level);
// check if any handler will handle this message so we can return early and save cycles // check if any handler will handle this message so we can return early and save cycles
$handlerKey = null; $handlerKey = null;
reset($this->handlers); reset($this->handlers);
@@ -297,6 +295,8 @@ class Logger implements LoggerInterface
return false; return false;
} }
$levelName = static::getLevelName($level);
$record = [ $record = [
'message' => $message, 'message' => $message,
'context' => $context, 'context' => $context,