Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.99 diff -u -r1.99 bootstrap.inc --- includes/bootstrap.inc 7 May 2006 00:08:36 -0000 1.99 +++ includes/bootstrap.inc 16 May 2006 16:46:34 -0000 @@ -636,18 +636,7 @@ * A link to associate with the message. */ 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); - } + module_invoke_all('watchdog', $type, $message, $severity, $link); } /** Index: modules/watchdog.module =================================================================== RCS file: /cvs/drupal/drupal/modules/watchdog.module,v retrieving revision 1.144 diff -u -r1.144 watchdog.module --- modules/watchdog.module 7 May 2006 00:08:36 -0000 1.144 +++ modules/watchdog.module 16 May 2006 16:46:34 -0000 @@ -52,6 +52,26 @@ } /** + * Implementation of hook_watchdog(). + * + * Logs a watchdog event in the database. + */ +function watchdog_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); + } +} + +/** * Implementation of hook_cron(). * * Remove expired log messages and flood control events.