You are here

function watchdog_rules_watchdog in Logging and alerts 7.2

Same name and namespace in other branches
  1. 6.2 watchdog_rules/watchdog_rules.module \watchdog_rules_watchdog()
  2. 6 watchdog_rules/watchdog_rules.module \watchdog_rules_watchdog()
  3. 7 watchdog_rules/watchdog_rules.module \watchdog_rules_watchdog()

Implements hook_watchdog().

File

watchdog_rules/watchdog_rules.module, line 12
Provides a Rules integration for wachdog events.

Code

function watchdog_rules_watchdog($watchdog_message) {

  // Make sure we do not provide NULL values, as Rules module doesn't like them.
  // @see http://drupal.org/node/1497534
  foreach ($watchdog_message as $key => $value) {
    if (is_null($value)) {
      $watchdog_message[$key] = '';
    }
  }

  // Make sure that 'variables' is array, because t() required array value.
  if (empty($watchdog_message['variables'])) {
    $watchdog_message['variables'] = array();
  }
  rules_invoke_event('watchdog_rules', $watchdog_message['user'], $watchdog_message['type'], $watchdog_message['request_uri'], $watchdog_message['referer'], $watchdog_message['ip'], $watchdog_message['timestamp'], $watchdog_message['severity'], $watchdog_message['link'], t($watchdog_message['message'], $watchdog_message['variables']));
}