You are here

function watchdog_triggers_admin_settings in Logging and alerts 6

Same name and namespace in other branches
  1. 6.2 watchdog_triggers/watchdog_triggers.module \watchdog_triggers_admin_settings()
  2. 7.2 watchdog_triggers/watchdog_triggers.module \watchdog_triggers_admin_settings()
  3. 7 watchdog_triggers/watchdog_triggers.module \watchdog_triggers_admin_settings()

Implements form page callback for module admin settings page

1 string reference to 'watchdog_triggers_admin_settings'
watchdog_triggers_menu in watchdog_triggers/watchdog_triggers.module
Implementation of hook_menu().

File

watchdog_triggers/watchdog_triggers.module, line 173
Provides a Trigger and Action integration for watchdog events.

Code

function watchdog_triggers_admin_settings() {
  $form = array();

  // Check against the following features of watchdog.
  $form['watchdog_triggers_info'] = array(
    '#type' => 'item',
    '#description' => t('The settings set here apply to all watchdog actions. These are cumulative filters. ' . 'The more filters you set the narrower your selection of watchdog events will be. If you need more fine ' . 'control or multiple configurations then you need to upgrade to the Rules integration for Watchdog.'),
  );

  // type (module name)
  $form['watchdog_triggers_type'] = array(
    '#type' => 'textarea',
    '#title' => t('Message type'),
    '#default_value' => variable_get('watchdog_triggers_type', ''),
    '#description' => t('Enter each type to trigger against, usually the module of origin, separated by a comma.'),
  );

  // user
  $form['watchdog_triggers_user'] = array(
    '#type' => 'textarea',
    '#title' => t('User generating message'),
    '#default_value' => variable_get('watchdog_triggers_user', ''),
    '#description' => t('Enter each user name to trigger against, separated by a comma.'),
  );

  // request uri
  $form['watchdog_triggers_request_uri'] = array(
    '#type' => 'textarea',
    '#title' => t('Message request uri'),
    '#default_value' => variable_get('watchdog_triggers_request_uri', ''),
    '#description' => t('Enter each regular expression to match the requesting uri against, separated by a comma.'),
  );

  // referer
  $form['watchdog_triggers_referer'] = array(
    '#type' => 'textarea',
    '#title' => t('Message referer'),
    '#default_value' => variable_get('watchdog_triggers_referer', ''),
    '#description' => t('Enter each regular expression to match the refering page against, separated by a comma.'),
  );

  // ip
  $form['watchdog_triggers_ip'] = array(
    '#type' => 'textarea',
    '#title' => t('IP generating message'),
    '#default_value' => variable_get('watchdog_triggers_ip', ''),
    '#description' => t('Enter each regular expression to match the IP against, separated by a comma.'),
  );

  // severity
  $array_options = array(
    -100 => 'none',
    WATCHDOG_EMERG => 'Emergency: system is unusable',
    WATCHDOG_ALERT => 'Alert: action must be taken immediately',
    WATCHDOG_CRITICAL => 'Critical: critical conditions',
    WATCHDOG_ERROR => 'Error: error conditions',
    WATCHDOG_WARNING => 'Warning: warning conditions',
    WATCHDOG_NOTICE => 'Notice: normal but significant condition',
    WATCHDOG_INFO => 'Informational: informational messages',
    WATCHDOG_DEBUG => 'Debug: debug-level messages',
  );
  $form['watchdog_triggers_severity'] = array(
    '#type' => 'select',
    '#title' => t('Message severity'),
    '#default_value' => variable_get('watchdog_triggers_severity', array(
      WATCHDOG_CRITICAL,
      WATCHDOG_ALERT,
      WATCHDOG_EMERG,
    )),
    '#options' => $array_options,
    '#description' => t('Select each severity to trigger against.'),
    '#multiple' => TRUE,
  );

  // message
  $form['watchdog_triggers_message'] = array(
    '#type' => 'textarea',
    '#title' => t('Message pattern'),
    '#default_value' => variable_get('watchdog_triggers_message', ''),
    '#description' => t('Enter each regular expression to match the message against, separated by a comma.'),
  );
  return system_settings_form($form);
}