mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-06 05:07:36 +02:00
Tweak patch a bit, refs #617
This commit is contained in:
@@ -176,19 +176,18 @@ class Logger implements LoggerInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set handlers, removing all existing ones.
|
* Set handlers, replacing all existing ones.
|
||||||
* Falsey values will be ignored, and if a map is passed, keys will be ignored.
|
|
||||||
*
|
*
|
||||||
* @param array $handlers All elements must be of type HandlerInterface
|
* If a map is passed, keys will be ignored.
|
||||||
|
*
|
||||||
|
* @param HandlerInterface[] $handlers
|
||||||
* @return $this
|
* @return $this
|
||||||
*/
|
*/
|
||||||
public function setHandlers(array $handlers)
|
public function setHandlers(array $handlers)
|
||||||
{
|
{
|
||||||
$this->handlers = array();
|
$this->handlers = array();
|
||||||
foreach ($handlers as $handler) {
|
foreach (array_reverse($handlers) as $handler) {
|
||||||
if ($handler) {
|
$this->pushHandler($handler);
|
||||||
$this->pushHandler($handler);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
@@ -156,11 +156,11 @@ class LoggerTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$logger->setHandlers(array(
|
$logger->setHandlers(array(
|
||||||
"AMapKey" => $handler1,
|
"AMapKey" => $handler1,
|
||||||
"Falsey" => null,
|
"Woop" => $handler2,
|
||||||
));
|
));
|
||||||
|
|
||||||
// Keys have been scrubbed
|
// Keys have been scrubbed
|
||||||
$this->assertEquals(array($handler1), $logger->getHandlers());
|
$this->assertEquals(array($handler1, $handler2), $logger->getHandlers());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user