You are here

public function CommonUtilities::watchdogThrowable in Convert Media Tags to Markup 8

Same name and namespace in other branches
  1. 2.x src/traits/CommonUtilities.php \Drupal\convert_media_tags_to_markup\traits\CommonUtilities::watchdogThrowable()

Log a \Throwable to the watchdog.

Parameters

\Throwable $t: A \throwable.

mixed $message: The message to store in the log. If empty, a text that contains all useful information about the passed-in exception is used.

mixed $variables: Array of variables to replace in the message on display or NULL if message is already translated or not possible to translate.

mixed $severity: The severity of the message, as per RFC 3164.

mixed $link: A link to associate with the message.

1 call to CommonUtilities::watchdogThrowable()
App::tokenToMarkup in src/ConvertMediaTagsToMarkup/App.php
Replace callback to convert a media file tag into HTML markup.

File

src/traits/CommonUtilities.php, line 117

Class

CommonUtilities
General utilities trait.

Namespace

Drupal\convert_media_tags_to_markup\traits

Code

public function watchdogThrowable(\Throwable $t, $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($t);
  \Drupal::logger('steward_common')
    ->log($severity, $message, $variables);
}