public static function ErrorHandler::setLogger in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/debug/ErrorHandler.php \Symfony\Component\Debug\ErrorHandler::setLogger()
Sets a logger for the given channel.
Parameters
LoggerInterface $logger A logger interface:
string $channel The channel associated with the logger (deprecation, emergency or scream):
Deprecated
since version 2.6, to be removed in 3.0. Use setLoggers() or setDefaultLogger() instead.
1 call to ErrorHandler::setLogger()
- ErrorsLoggerListener::injectLogger in vendor/
symfony/ http-kernel/ EventListener/ ErrorsLoggerListener.php
File
- vendor/
symfony/ debug/ ErrorHandler.php, line 671
Class
- ErrorHandler
- A generic ErrorHandler for the PHP engine.
Namespace
Symfony\Component\DebugCode
public static function setLogger(LoggerInterface $logger, $channel = 'deprecation') {
@trigger_error('The ' . __METHOD__ . ' static method is deprecated since version 2.6 and will be removed in 3.0. Use the setLoggers() or setDefaultLogger() methods instead.', E_USER_DEPRECATED);
$handler = set_error_handler('var_dump', 0);
$handler = is_array($handler) ? $handler[0] : null;
restore_error_handler();
if (!$handler instanceof self) {
return;
}
if ('deprecation' === $channel) {
$handler
->setDefaultLogger($logger, E_DEPRECATED | E_USER_DEPRECATED, true);
$handler
->screamAt(E_DEPRECATED | E_USER_DEPRECATED);
}
elseif ('scream' === $channel) {
$handler
->setDefaultLogger($logger, E_ALL | E_STRICT, false);
$handler
->screamAt(E_ALL | E_STRICT);
}
elseif ('emergency' === $channel) {
$handler
->setDefaultLogger($logger, E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR, true);
$handler
->screamAt(E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
}
}