raven.module in Raven: Sentry Integration 8.2
Same filename and directory in other branches
Raven Drupal module.
File
raven.moduleView source
<?php
/**
* @file
* Raven Drupal module.
*/
use Drupal\raven\Form\RavenConfigForm;
/**
* Implements hook_page_attachments().
*/
function raven_page_attachments(array &$page) {
$config = \Drupal::config('raven.settings');
if ($config
->get('javascript_error_handler') && \Drupal::currentUser()
->hasPermission('send javascript errors to sentry')) {
// Other modules can attach Sentry browser client options to the page.
if (!isset($page['#attached']['drupalSettings']['raven']['options'])) {
$page['#attached']['drupalSettings']['raven']['options'] = new \stdClass();
}
$page['#attached']['drupalSettings']['raven']['options']->dsn = empty($_SERVER['SENTRY_DSN']) ? $config
->get('public_dsn') : $_SERVER['SENTRY_DSN'];
$page['#attached']['drupalSettings']['raven']['options']->environment = empty($_SERVER['SENTRY_ENVIRONMENT']) ? $config
->get('environment') ?: \Drupal::getContainer()
->getParameter('kernel.environment') : $_SERVER['SENTRY_ENVIRONMENT'];
if (!empty($_SERVER['SENTRY_RELEASE'])) {
$page['#attached']['drupalSettings']['raven']['options']->release = $_SERVER['SENTRY_RELEASE'];
}
elseif ($release = $config
->get('release')) {
$page['#attached']['drupalSettings']['raven']['options']->release = $release;
}
$page['#attached']['drupalSettings']['raven']['options']->integrations = [];
if ($traces = $config
->get('browser_traces_sample_rate')) {
$page['#attached']['drupalSettings']['raven']['options']->tracesSampleRate = $traces;
}
$page['#attached']['drupalSettings']['raven']['options']->autoSessionTracking = $config
->get('auto_session_tracking');
$page['#attached']['drupalSettings']['raven']['options']->sendClientReports = $config
->get('send_client_reports');
$page['#attached']['library'][] = 'raven/raven';
}
}
/**
* Implements hook_form_system_logging_settings_alter().
*/
function raven_form_system_logging_settings_alter(array &$form) {
RavenConfigForm::buildForm($form);
}
Functions
Name | Description |
---|---|
raven_form_system_logging_settings_alter | Implements hook_form_system_logging_settings_alter(). |
raven_page_attachments | Implements hook_page_attachments(). |