You are here

function linkchecker_watchdog_log in Link checker 8

Same name and namespace in other branches
  1. 7 linkchecker.module \linkchecker_watchdog_log()

Conditionally logs a system message.

RFC 3164:

  • WATCHDOG_EMERGENCY: Emergency, system is unusable.
  • RfcLogLevel::ALERT: Alert, action must be taken immediately.
  • RfcLogLevel::CRITICAL: Critical conditions.
  • WATCHDOG_ERROR: Error conditions.
  • WATCHDOG_WARNING: Warning conditions.
  • RfcLogLevel::NOTICE: (default) Normal but significant conditions.
  • WATCHDOG_INFO: Informational messages.
  • WATCHDOG_DEBUG: Debug-level messages.

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().

$message: The message to store in the log. Keep $message translatable by not concatenating dynamic values into it! Variables in the message should be added by using placeholder strings alongside the variables argument to declare the value of the placeholders. See t() for documentation on how $message and $variables interact.

$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

$link: A link to associate with the message.

See also

watchdog_severity_levels()

watchdog()

2 calls to linkchecker_watchdog_log()
LinkCheckerService::exceptionHandling in src/LinkCheckerService.php
Exception handling.
LinkCheckerService::statusHandling in src/LinkCheckerService.php
Status code handling.

File

./linkchecker.module, line 61
This module periodically check links in given node types, blocks etc.

Code

function linkchecker_watchdog_log($type, $message, $variables = [], $severity = RfcLogLevel::NOTICE, $link = NULL) {

  // @FIXME: $link is missing, could be in $variables.
  if ($severity <= \Drupal::config('linkchecker.settings')
    ->get('logging.level')) {
    $logger = \Drupal::logger($type);
    $logger
      ->log($severity, $message, $variables);
  }
}