? files ? hook_watchdog.patch ? hook_watchdog_bootstrap.patch ? test.php ? modules/rawlog ? sites/HEAD 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 17 May 2006 16:56:03 -0000 @@ -458,7 +458,7 @@ function bootstrap_invoke_all($hook) { foreach (module_list(FALSE, TRUE) as $module) { drupal_load('module', $module); - module_invoke($module, $hook); + module_invoke($module, func_get_args()); } } @@ -561,7 +561,7 @@ * Define the critical hooks that force modules to always be loaded. */ function bootstrap_hooks() { - return array('init', 'exit'); + return array('init', 'exit', 'watchdog'); } /** @@ -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); - } + bootstrap_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 17 May 2006 16:56:03 -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.