You are here

function emaillog_watchdog in Logging and alerts 6

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

Implementation of hook_watchdog().

File

emaillog/emaillog.module, line 39
Sends logs and alerts to email addresses.

Code

function emaillog_watchdog($log) {
  global $user;
  $to = variable_get('emaillog_' . $log['severity'], '');
  if ($to) {

    // Send email only if there is an email address. Otherwise the message is ignored
    // by this module.
    $language = user_preferred_language($user);
    drupal_mail('emaillog', 'alert', $to, $language, $log);
  }
}