| Versions | |
|---|---|
| 4.7 – 5 | watchdog($type, $message, $severity = WATCHDOG_NOTICE, $link = NULL) |
| 6 – 7 | watchdog($type, $message, $variables = array(), $severity = WATCHDOG_NOTICE, $link = NULL) |
Log a system message.
$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.
includes/
<?php
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);
}
}
?>