You are here

function watchdog_event in Drupal 4

Same name and namespace in other branches
  1. 5 modules/watchdog/watchdog.module \watchdog_event()

Menu callback; displays details about a log message.

1 string reference to 'watchdog_event'
watchdog_menu in modules/watchdog.module
Implementation of hook_menu().

File

modules/watchdog.module, line 161
System monitoring and logging for administrators.

Code

function watchdog_event($id) {
  $severity = array(
    WATCHDOG_NOTICE => t('notice'),
    WATCHDOG_WARNING => t('warning'),
    WATCHDOG_ERROR => t('error'),
  );
  $output = '';
  $result = db_query('SELECT w.*, u.name, u.uid FROM {watchdog} w INNER JOIN {users} u ON w.uid = u.uid WHERE w.wid = %d', $id);
  if ($watchdog = db_fetch_object($result)) {
    $header = array(
      t('Type'),
      t('Date'),
      t('User'),
      t('Location'),
      t('Referrer'),
      t('Message'),
      t('Severity'),
      t('Hostname'),
    );
    $data = array(
      t($watchdog->type),
      format_date($watchdog->timestamp, 'large'),
      theme('username', $watchdog),
      l($watchdog->location, $watchdog->location),
      l($watchdog->referer, $watchdog->referer),
      $watchdog->message,
      $severity[$watchdog->severity],
      $watchdog->hostname,
    );
    $output = theme('watchdog_event', $header, $data);
  }
  return $output;
}