public function ErrorHandler::setLoggers in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/debug/ErrorHandler.php \Symfony\Component\Debug\ErrorHandler::setLoggers()
Sets a logger for each error level.
Parameters
array $loggers Error levels to [LoggerInterface|null, LogLevel::*] map:
Return value
array The previous map
Throws
\InvalidArgumentException
1 call to ErrorHandler::setLoggers()
- ErrorHandler::setDefaultLogger in vendor/
symfony/ debug/ ErrorHandler.php - Sets a logger to non assigned errors levels.
File
- vendor/
symfony/ debug/ ErrorHandler.php, line 195
Class
- ErrorHandler
- A generic ErrorHandler for the PHP engine.
Namespace
Symfony\Component\DebugCode
public function setLoggers(array $loggers) {
$prevLogged = $this->loggedErrors;
$prev = $this->loggers;
foreach ($loggers as $type => $log) {
if (!isset($prev[$type])) {
throw new \InvalidArgumentException('Unknown error type: ' . $type);
}
if (!is_array($log)) {
$log = array(
$log,
);
}
elseif (!array_key_exists(0, $log)) {
throw new \InvalidArgumentException('No logger provided');
}
if (null === $log[0]) {
$this->loggedErrors &= ~$type;
}
elseif ($log[0] instanceof LoggerInterface) {
$this->loggedErrors |= $type;
}
else {
throw new \InvalidArgumentException('Invalid logger provided');
}
$this->loggers[$type] = $log + $prev[$type];
}
$this
->reRegister($prevLogged | $this->thrownErrors);
return $prev;
}