You are here

function errorlog_watchdog in Logging and alerts 6.2

Same name and namespace in other branches
  1. 6 errorlog/errorlog.module \errorlog_watchdog()
  2. 7.2 errorlog/errorlog.module \errorlog_watchdog()
  3. 7 errorlog/errorlog.module \errorlog_watchdog()

Implementation of hook_watchdog().

File

errorlog/errorlog.module, line 39
Sends logs and alerts to the web server's log.

Code

function errorlog_watchdog($log) {
  global $user;
  if (variable_get('errorlog_' . $log['severity'], FALSE)) {
    $language = user_preferred_language($user);

    // Make sure that $log['variables'] is always an array to avoid
    // errors like in issue http://drupal.org/node/1325938
    if (!is_array($log['variables'])) {
      $log['variables'] = array();
    }

    // Send themed alert to the web server's log.
    $message = theme('errorlog_format', $log);
    error_log($message);
  }
}