1
0
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:
Jordi Boggiano
2015-08-09 18:24:59 +01:00
2 changed files with 43 additions and 0 deletions

View File

@@ -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[]
*/