Skip to content

Commit f697ec7

Browse files
zerkmsSeldaek
authored andcommitted
Move human readable level name resolution in Logger::addRecord() to as late as possible (Seldaek#934)
1 parent 7dd45ac commit f697ec7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Monolog/Logger.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,6 @@ public function useMicrosecondTimestamps(bool $micro)
279279
*/
280280
public function addRecord(int $level, string $message, array $context = []): bool
281281
{
282-
$levelName = static::getLevelName($level);
283-
284282
// check if any handler will handle this message so we can return early and save cycles
285283
$handlerKey = null;
286284
reset($this->handlers);
@@ -297,6 +295,8 @@ public function addRecord(int $level, string $message, array $context = []): boo
297295
return false;
298296
}
299297

298+
$levelName = static::getLevelName($level);
299+
300300
$record = [
301301
'message' => $message,
302302
'context' => $context,

0 commit comments

Comments
 (0)