public function Raven::__construct in Raven: Sentry Integration 3.x
Same name in this branch
- 3.x src/Logger/Raven.php \Drupal\raven\Logger\Raven::__construct()
- 3.x src/Plugin/CspReportingHandler/Raven.php \Drupal\raven\Plugin\CspReportingHandler\Raven::__construct()
Same name and namespace in other branches
- 8.2 src/Logger/Raven.php \Drupal\raven\Logger\Raven::__construct()
- 8 src/Logger/Raven.php \Drupal\raven\Logger\Raven::__construct()
Constructs a Raven log object.
Parameters
\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The configuration factory object.
\Drupal\Core\Logger\LogMessageParserInterface $parser: The parser to use when extracting message variables.
\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The module handler.
string $environment: The kernel.environment parameter.
\Drupal\Core\Session\AccountInterface|null $current_user: The current user (optional).
\Symfony\Component\HttpFoundation\RequestStack|null $request_stack: The request stack (optional).
\Drupal\Core\Site\Settings $settings: The settings array (optional).
File
- src/
Logger/ Raven.php, line 117
Class
- Raven
- Logs events to Sentry.
Namespace
Drupal\raven\LoggerCode
public function __construct(ConfigFactoryInterface $config_factory, LogMessageParserInterface $parser, ModuleHandlerInterface $module_handler, $environment, AccountInterface $current_user = NULL, RequestStack $request_stack = NULL, Settings $settings = NULL) {
$this->configFactory = $config_factory;
$config = $this->configFactory
->get('raven.settings');
$this->currentUser = $current_user;
$this->requestStack = $request_stack;
$this->moduleHandler = $module_handler;
$this->parser = $parser;
$this->environment = $config
->get('environment') ?: $environment;
$this->settings = $settings ?: Settings::getInstance();
// We cannot lazily initialize Sentry, because we want the scope to be
// immediately available for adding context, etc.
$this
->getClient();
// Add Drush console error event listener.
if (function_exists('drush_main') && $config
->get('drush_error_handler') && method_exists(Drush::class, 'service')) {
Drush::service('eventDispatcher')
->addListener(ConsoleEvents::ERROR, [
$this,
'onConsoleError',
]);
}
}