You are here

function watchdog in Drupal 4

Same name and namespace in other branches
  1. 5 includes/bootstrap.inc \watchdog()
  2. 6 includes/bootstrap.inc \watchdog()
  3. 7 includes/bootstrap.inc \watchdog()

Log a system message.

Parameters

$type: The category to which this message belongs.

$message: The message to store in the log.

$severity: The severity of the message. One of the following values:

$link: A link to associate with the message.

58 calls to watchdog()
aggregator_form_category_submit in modules/aggregator.module
Process aggregator_form_category form submissions. @todo Add delete confirmation dialog.
aggregator_form_feed_submit in modules/aggregator.module
Process aggregator_form_feed form submissions. @todo Add delete confirmation dialog.
aggregator_parse_feed in modules/aggregator.module
aggregator_refresh in modules/aggregator.module
Checks a news feed for new items.
blogapi_blogger_edit_post in modules/blogapi.module
Blogging API callback. Modifies the specified blog node.

... See full list

5 string references to 'watchdog'
module_list in includes/module.inc
Collect a list of all loaded modules. During the bootstrap, return only vital modules. See bootstrap.inc
system_modules in modules/system.module
Menu callback; displays a listing of all modules.
system_update_162 in database/updates.inc
system_update_169 in database/updates.inc
update_fix_watchdog in ./update.php
System update 142 changes the watchdog table, which breaks the update script's ability to use logging. This changes the table appropriately.

File

includes/bootstrap.inc, line 693
Functions that need to be loaded on every Drupal request.

Code

function watchdog($type, $message, $severity = WATCHDOG_NOTICE, $link = NULL) {
  global $user, $base_root;
  $current_db = db_set_active();

  // Note: log the exact, entire absolute URL.
  $request_uri = $base_root . request_uri();
  db_query("INSERT INTO {watchdog} (uid, type, message, severity, link, location, referer, hostname, timestamp) VALUES (%d, '%s', '%s', %d, '%s', '%s', '%s', '%s', %d)", $user->uid, $type, $message, $severity, $link, $request_uri, referer_uri(), $_SERVER['REMOTE_ADDR'], time());
  if ($current_db) {
    db_set_active($current_db);
  }
}