watchdog_exception()
watchdog_exception(string $type, \Exception $exception, string|null $message = null, array $variables = [], int $severity = \Drupal\Core\Logger\RfcLogLevel::ERROR, string|null $link = null) : mixed
Logs an exception through the logger service, as Drupal 7's watchdog_exception() did.
Replaces a function absent from Drupal 11.4.11 core (original cited above). Severity defaults to RfcLogLevel::ERROR where Drupal 7 used WATCHDOG_ERROR.
Parameters
| string | $type | The logger channel. |
| \Exception | $exception | The exception to log. |
| string|null | $message | The message, or null for the default exception message. |
| array | $variables | Placeholder replacements. Exception details are merged in. |
| int | $severity | The RFC 5424 log level. |
| string|null | $link | An optional link to attach to the entry. |