function Error::logException

Same name in other branches
  1. 11.x core/lib/Drupal/Core/Utility/Error.php \Drupal\Core\Utility\Error::logException()

Log a formatted exception message to the provided logger.

Parameters

\Psr\Log\LoggerInterface $logger: The logger.

\Throwable $exception: The exception.

string $message: (optional) The message.

array $additional_variables: (optional) Any additional variables.

string $level: The PSR log level. Must be valid constant in \Psr\Log\LogLevel.

21 calls to Error::logException()
ComponentLoader::exists in core/lib/Drupal/Core/Template/Loader/ComponentLoader.php
Cron::invokeCronHandlers in core/lib/Drupal/Core/Cron.php
Invokes any cron handlers implementing hook_cron.
Cron::processQueue in core/lib/Drupal/Core/Cron.php
Processes a cron queue.
JsOptimizer::optimize in core/lib/Drupal/Core/Asset/JsOptimizer.php
Optimizes an asset.
MatcherDumper::dump in core/lib/Drupal/Core/Routing/MatcherDumper.php
Dumps a set of routes to the router table in the database.

... See full list

File

core/lib/Drupal/Core/Utility/Error.php, line 94

Class

Error
Drupal error utility class.

Namespace

Drupal\Core\Utility

Code

public static function logException(LoggerInterface $logger, \Throwable $exception, string $message = Error::DEFAULT_ERROR_MESSAGE, array $additional_variables = [], string $level = LogLevel::ERROR) : void {
    $logger->log($level, $message, static::decodeException($exception) + $additional_variables);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.