Open github-actions[bot] opened 1 year ago
https://www.drupal.org/node/2932520
Introduced in branch/version: 10.1.x / 10.1.0
The procedural watchdog_exception() function has been deprecated.
watchdog_exception()
A number of classes that were using watchdog_exception() now explicitly inject a logger to be able to pass to \Drupal\Core\Utility\Error::logException()
\Drupal\Core\Utility\Error::logException()
Before, in a module called 'update':
Basic usage:
<?php watchdog_exception('update', $exception); ?>
After:
<?php use \Drupal\Core\Utility\Error; $logger = \Drupal::logger('update'); Error::logException($logger, $exception); ?>
Advanced usage:
Before:
<?php watchdog_exception('update', $exception, 'My custom message @foo', ['@foo' => 'bar'], RfcLogLevel::CRITICAL, 'http://example.com'); ?>
<?php use \Drupal\Core\Utility\Error; use \Psr\Log\LogLevel; $logger = \Drupal::logger('update'); Error::logException($logger, $exception, 'My custom message @foo', ['@foo' => 'bar', 'link' => 'http://example.com'], LogLevel::CRITICAL); ?>
Implemented this: https://github.com/mglaman/drupal-change-record-triage/issues/557
https://www.drupal.org/node/2932520
Introduced in branch/version: 10.1.x / 10.1.0
The procedural
watchdog_exception()
function has been deprecated.A number of classes that were using
watchdog_exception()
now explicitly inject a logger to be able to pass to\Drupal\Core\Utility\Error::logException()
Before, in a module called 'update':
Basic usage:
After:
Advanced usage:
Before:
After: