function watchdog in Drupal 6
Same name and namespace in other branches
- 4 includes/bootstrap.inc \watchdog()
- 5 includes/bootstrap.inc \watchdog()
- 7 includes/bootstrap.inc \watchdog()
Log a system message.
Parameters
$type: The category to which this message belongs. Can be any string, but the general practice is to use the name of the module calling watchdog(). The $type parameter is limited to 16 characters; anything longer is truncated.
$message: The message to store in the log. See t() for documentation on how $message and $variables interact. Keep $message translatable by not concatenating dynamic values into it!
$variables: Array of variables to replace in the message on display or NULL if message is already translated or not possible to translate.
$severity: The severity of the message; one of the following values as defined in RFC 3164:
- WATCHDOG_EMERGENCY: Emergency, system is unusable.
- WATCHDOG_ALERT: Alert, action must be taken immediately.
- WATCHDOG_CRITICAL: Critical conditions.
- WATCHDOG_ERROR: Error conditions.
- WATCHDOG_WARNING: Warning conditions.
- WATCHDOG_NOTICE: (default) Normal but significant conditions.
- WATCHDOG_INFO: Informational messages.
- WATCHDOG_DEBUG: Debug-level messages.
$link: A link to associate with the message.
See also
91 calls to watchdog()
- actions_do in includes/
actions.inc - Perform a given list of actions by executing their callback functions.
- actions_save in includes/
actions.inc - Save an action and its associated user-supplied parameter values to the database.
- actions_synchronize in includes/
actions.inc - Synchronize actions that are provided by modules.
- aggregator_form_category_submit in modules/
aggregator/ aggregator.admin.inc - Process aggregator_form_category form submissions.
- aggregator_form_feed_submit in modules/
aggregator/ aggregator.admin.inc - Process aggregator_form_feed form submissions.
3 string references to 'watchdog'
- dblog_update_6000 in modules/
dblog/ dblog.install - Allow longer referrers.
- system_update_6010 in modules/
system/ system.install - Add variable replacement for watchdog messages.
- system_update_6019 in modules/
system/ system.install - Reconcile small differences in the previous, manually created mysql and pgsql schemas so they are the same and can be represented by a single schema structure.
File
- includes/
bootstrap.inc, line 967 - Functions that need to be loaded on every Drupal request.
Code
function watchdog($type, $message, $variables = array(), $severity = WATCHDOG_NOTICE, $link = NULL) {
global $user, $base_root;
// Prepare the fields to be logged
$log_message = array(
'type' => $type,
'message' => $message,
'variables' => $variables,
'severity' => $severity,
'link' => $link,
'user' => $user,
'request_uri' => $base_root . request_uri(),
'referer' => referer_uri(),
'ip' => ip_address(),
'timestamp' => time(),
);
// Call the logging hooks to log/process the message
foreach (module_implements('watchdog') as $module) {
module_invoke($module, 'watchdog', $log_message);
}
}