public function ErrorHandler::setDefaultLogger in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/debug/ErrorHandler.php \Symfony\Component\Debug\ErrorHandler::setDefaultLogger()
Sets a logger to non assigned errors levels.
Parameters
LoggerInterface $logger A PSR-3 logger to put as default for the given levels:
array|int $levels An array map of E_* to LogLevel::* or an integer bit field of E_* constants:
bool $replace Whether to replace or not any existing logger:
File
- vendor/
symfony/ debug/ ErrorHandler.php, line 161
Class
- ErrorHandler
- A generic ErrorHandler for the PHP engine.
Namespace
Symfony\Component\DebugCode
public function setDefaultLogger(LoggerInterface $logger, $levels = null, $replace = false) {
$loggers = array();
if (is_array($levels)) {
foreach ($levels as $type => $logLevel) {
if (empty($this->loggers[$type][0]) || $replace) {
$loggers[$type] = array(
$logger,
$logLevel,
);
}
}
}
else {
if (null === $levels) {
$levels = E_ALL | E_STRICT;
}
foreach ($this->loggers as $type => $log) {
if ($type & $levels && (empty($log[0]) || $replace)) {
$log[0] = $logger;
$loggers[$type] = $log;
}
}
}
$this
->setLoggers($loggers);
}