protected function LoggerTrait::logException in Search API 8
Logs an exception.
Parameters
\Exception $exception: The exception that is going to be logged.
string|null $message: (optional) The message to display in the log, which can use variables retrieved from the exception (like "%type" or "@message"). Or NULL to use the default message.
array $variables: (optional) Array of variables to replace in the message when it is displayed, or NULL if the message should not be translated. The normal patterns for translation variables can be used.
int $severity: (optional) The severity of the message, as per RFC 3164.
string|null $link: (optional) A link to associate with the message, if any.
See also
\Drupal\Core\Utility\Error::decodeException()
36 calls to LoggerTrait::logException()
- BackendPluginBase::preDelete in src/
Backend/ BackendPluginBase.php - Notifies the backend that the server is about to be deleted.
- Basic::getIndexedItemsCount in src/
Plugin/ search_api/ tracker/ Basic.php - Retrieves the number of indexed items for this index.
- Basic::getRemainingItems in src/
Plugin/ search_api/ tracker/ Basic.php - Retrieves a list of item IDs that need to be indexed.
- Basic::getRemainingItemsCount in src/
Plugin/ search_api/ tracker/ Basic.php - Retrieves the total number of pending items for this index.
- Basic::getTotalItemsCount in src/
Plugin/ search_api/ tracker/ Basic.php - Retrieves the total number of items that are being tracked for this index.
File
- src/
LoggerTrait.php, line 65
Class
- LoggerTrait
- Provides helper methods for logging with dependency injection.
Namespace
Drupal\search_apiCode
protected function logException(\Exception $exception, $message = NULL, array $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($exception);
$this
->getLogger()
->log($severity, $message, $variables);
}