function watchdog_exception in Drupal 8
Same name and namespace in other branches
- 7 includes/bootstrap.inc \watchdog_exception()
- 9 core/includes/bootstrap.inc \watchdog_exception()
Logs an exception.
This is a wrapper logging function which automatically decodes an exception.
Parameters
$type: The category to which this message belongs.
$exception: The exception that is going to be logged.
$message: The message to store in the log. If empty, a text that contains all useful information about the passed-in exception is used.
$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, as per RFC 3164.
$link: A link to associate with the message.
See also
\Drupal\Core\Utility\Error::decodeException()
16 calls to watchdog_exception()
- Cron::invokeCronHandlers in core/
lib/ Drupal/ Core/ Cron.php - Invokes any cron handlers implementing hook_cron.
- Cron::processQueues in core/
lib/ Drupal/ Core/ Cron.php - Processes cron queues.
- DefaultParser::parse in core/
modules/ aggregator/ src/ Plugin/ aggregator/ parser/ DefaultParser.php - Parses feed data.
- ItemsImporter::refresh in core/
modules/ aggregator/ src/ ItemsImporter.php - Updates the feed items by triggering the import process.
- MatcherDumper::dump in core/
lib/ Drupal/ Core/ Routing/ MatcherDumper.php - Dumps a set of routes to the router table in the database.
File
- core/
includes/ bootstrap.inc, line 434 - Functions that need to be loaded on every Drupal request.
Code
function watchdog_exception($type, Exception $exception, $message = NULL, $variables = [], $severity = RfcLogLevel::ERROR, $link = NULL) {
// Use a default value if $message is not set.
if (empty($message)) {
$message = '%type: @message in %function (line %line of %file).';
}
if ($link) {
$variables['link'] = $link;
}
$variables += Error::decodeException($exception);
\Drupal::logger($type)
->log($severity, $message, $variables);
}