You are here

public function UltimateCronLogEntry::log in Ultimate Cron 7.2

Re-implementation of watchdog().

See also

watchdog()

File

./ultimate_cron.plugin.inc, line 1483
Plugin framework for Ultimate Cron.

Class

UltimateCronLogEntry
Abstract class for Ultimate Cron log entries.

Code

public function log($type, $message, $variables = array(), $severity = WATCHDOG_NOTICE, $link = NULL) {
  global $user, $base_root;

  // The user object may not exist in all conditions,
  // so 0 is substituted if needed.
  $user_uid = isset($user->uid) ? $user->uid : 0;

  // Prepare the fields to be logged.
  $log_entry = array(
    'type' => $type,
    'message' => $message,
    'variables' => $variables,
    'severity' => $severity,
    'link' => $link,
    'user' => $user,
    'uid' => $user_uid,
    'request_uri' => $base_root . request_uri(),
    'referer' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '',
    'ip' => ip_address(),
    // Request time isn't accurate for long processes, use time() instead.
    'timestamp' => time(),
  );
  $this
    ->watchdog($log_entry);
}