public function SalesforceLoggerSubscriber::salesforceException in Salesforce Suite 8.4
Same name and namespace in other branches
- 8.3 modules/salesforce_logger/src/EventSubscriber/SalesforceLoggerSubscriber.php \Drupal\salesforce_logger\EventSubscriber\SalesforceLoggerSubscriber::salesforceException()
- 5.0.x modules/salesforce_logger/src/EventSubscriber/SalesforceLoggerSubscriber.php \Drupal\salesforce_logger\EventSubscriber\SalesforceLoggerSubscriber::salesforceException()
SalesforceException event callback.
Parameters
\Drupal\salesforce\Event\SalesforceExceptionEventInterface $event: The event.
File
- modules/
salesforce_logger/ src/ EventSubscriber/ SalesforceLoggerSubscriber.php, line 56
Class
- SalesforceLoggerSubscriber
- Class SalesforceLoggerSubscriber.
Namespace
Drupal\salesforce_logger\EventSubscriberCode
public function salesforceException(SalesforceExceptionEventInterface $event) {
$log_level_setting = \Drupal::configFactory()
->get('salesforce_logger.settings')
->get('log_level');
$event_level = $event
->getLevel();
// Only log events whose log level is greater or equal to min log level
// setting.
if ($log_level_setting != SalesforceEvents::NOTICE) {
if ($log_level_setting == SalesforceEvents::ERROR && $event_level != RfcLogLevel::ERROR) {
return;
}
if ($log_level_setting == SalesforceEvents::WARNING && $event_level == RfcLogLevel::NOTICE) {
return;
}
}
$exception = $event
->getException();
if ($exception) {
$this->logger
->log($event
->getLevel(), self::EXCEPTION_MESSAGE_PLACEHOLDER, Error::decodeException($exception));
}
else {
$this->logger
->log($event
->getLevel(), $event
->getMessage(), $event
->getContext());
}
}