mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-24 01:56:18 +02:00
Merge remote-tracking branch 'sminnee/logger-sethandlers'
This commit is contained in:
@@ -175,6 +175,25 @@ class Logger implements LoggerInterface
|
||||
return array_shift($this->handlers);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set handlers, removing 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
|
||||
* @return $this
|
||||
*/
|
||||
public function setHandlers(array $handlers)
|
||||
{
|
||||
$this->handlers = array();
|
||||
foreach ($handlers as $handler) {
|
||||
if ($handler) {
|
||||
$this->pushHandler($handler);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return HandlerInterface[]
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user