You are here

function _views_watchdog_get_severity in Views Watchdog 7.3

Same name and namespace in other branches
  1. 6.3 views_watchdog.module \_views_watchdog_get_severity()
  2. 6.2 views_watchdog.module \_views_watchdog_get_severity()

Helper function; retrieves list of severity levels.

8 calls to _views_watchdog_get_severity()
template_preprocess_views_view_watchdog_table in views/theme/theme.inc
Display a view as a watchdog table style.
views_handler_field_watchdog_severity::options_form in views/handlers/views_handler_field_watchdog_severity.inc
Default options form provides the label widget that all fields should have.
views_handler_field_watchdog_severity::options_validate in views/handlers/views_handler_field_watchdog_severity.inc
Validate the options form.
views_handler_field_watchdog_severity::option_definition in views/handlers/views_handler_field_watchdog_severity.inc
Information about options for all kinds of purposes will be held here.
views_handler_field_watchdog_severity::render in views/handlers/views_handler_field_watchdog_severity.inc
Render the field.

... See full list

File

./views_watchdog.module, line 42
This module extends the Views module and allows to create customized lists (pages, blocks, feeds) of watchdog entries.

Code

function _views_watchdog_get_severity($code = NULL, $item = NULL) {
  static $drupal_static_fast;
  if (!isset($drupal_static_fast)) {
    $drupal_static_fast['severity'] =& drupal_static(__FUNCTION__);
  }
  $severity =& $drupal_static_fast['severity'];
  if (!isset($severity)) {
    $severity[WATCHDOG_EMERGENCY] = array(
      'title' => t('Emergency'),
      'text' => t('System is unusable.'),
      'icon' => 'misc/watchdog-error.png',
      'arg' => 'emergency',
    );
    $severity[WATCHDOG_ALERT] = array(
      'title' => t('Alert'),
      'text' => t('Action must be taken immediately.'),
      'icon' => 'misc/watchdog-error.png',
      'arg' => 'alert',
    );
    $severity[WATCHDOG_CRITICAL] = array(
      'title' => t('Critical'),
      'text' => t('Critical conditions.'),
      'icon' => 'misc/watchdog-error.png',
      'arg' => 'critical',
    );
    $severity[WATCHDOG_ERROR] = array(
      'title' => t('Error'),
      'text' => t('Error conditions.'),
      'icon' => 'misc/watchdog-error.png',
      'arg' => 'error',
    );
    $severity[WATCHDOG_WARNING] = array(
      'title' => t('Warning'),
      'text' => t('Warning conditions.'),
      'icon' => 'misc/watchdog-warning.png',
      'arg' => 'warning',
    );
    $severity[WATCHDOG_NOTICE] = array(
      'title' => t('Notice'),
      'text' => t('Normal but significant condition.'),
      'icon' => '',
      'arg' => 'notice',
    );
    $severity[WATCHDOG_INFO] = array(
      'title' => t('Info'),
      'text' => t('Informational messages.'),
      'icon' => '',
      'arg' => 'info',
    );
    $severity[WATCHDOG_DEBUG] = array(
      'title' => t('Debug'),
      'text' => t('Debug-level messages.'),
      'icon' => '',
      'arg' => 'debug',
    );
  }
  return $code ? $item ? $severity[$code][$item] : $severity[$code] : $severity;
}