watchdog_exception($type, Exception $exception, $message = NULL, $variables = array(), $severity = RfcLogLevel::ERROR, $link = NULL)
Logs an exception.
This is a wrapper logging function which automatically decodes an exception.
$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.
\Drupal\Core\Utility\Error::decodeException()
function watchdog_exception($type, Exception $exception, $message = NULL, $variables = array(), $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); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!includes!bootstrap.inc/function/watchdog_exception/8.1.x