You are here

public function RealisticDummyContentDrupalTrait::watchdogThrowable in Realistic Dummy Content 3.x

Log a \Throwable to the watchdog.

Modeled after Core's watchdog_exception().

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 RealisticDummyContentDrupalTrait::watchdogThrowable()
RealisticDummyContentAttribute::imageSave in api/src/includes/RealisticDummyContentAttribute.php
Return an image file object if possible.

File

api/src/traits/RealisticDummyContentDrupalTrait.php, line 84

Class

RealisticDummyContentDrupalTrait
A trait with wrappers to system calls.

Namespace

Drupal\realistic_dummy_content_api\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);

  // @phpstan-ignore-next-line
  \Drupal::logger('steward_common')
    ->log($severity, $message, $variables);
}