mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-06 21:26:43 +02:00
Replaced current/next-style loop with foreach
This commit is contained in:
@@ -283,14 +283,11 @@ class Logger implements LoggerInterface
|
|||||||
|
|
||||||
// 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);
|
foreach ($this->handlers as $key => $handler) {
|
||||||
while ($handler = current($this->handlers)) {
|
|
||||||
if ($handler->isHandling(['level' => $level])) {
|
if ($handler->isHandling(['level' => $level])) {
|
||||||
$handlerKey = key($this->handlers);
|
$handlerKey = $key;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
next($this->handlers);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null === $handlerKey) {
|
if (null === $handlerKey) {
|
||||||
@@ -311,7 +308,17 @@ class Logger implements LoggerInterface
|
|||||||
$record = call_user_func($processor, $record);
|
$record = call_user_func($processor, $record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reset($this->handlers);
|
||||||
|
$skip = true;
|
||||||
while ($handler = current($this->handlers)) {
|
while ($handler = current($this->handlers)) {
|
||||||
|
if ($skip) {
|
||||||
|
if ($key !== key($this->handlers)) {
|
||||||
|
next($this->handlers);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$skip = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (true === $handler->handle($record)) {
|
if (true === $handler->handle($record)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user