public function WebformSubmissionStorage::log in Webform 8.5
Write an event to the webform submission log.
Parameters
\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission.
array $context: The values/context to be logged includes 'handler_id', 'operation', 'message', and 'data'.
Overrides WebformSubmissionStorageInterface::log
Deprecated
Instead call the 'webform_submission' logger channel directly.
$message = 'Some message with an %argument.' $context = [ '%argument' => 'Some value' 'link' => $webform_submission->toLink($this->t('Edit'), 'edit-form')->toString(), 'webform_submission' => $webform_submission, 'handler_id' => NULL, 'data' => [], ]; \Drupal::logger('webform_submission')->notice($message, $context);
File
- src/
WebformSubmissionStorage.php, line 1454
Class
- WebformSubmissionStorage
- Defines the webform submission storage.
Namespace
Drupal\webformCode
public function log(WebformSubmissionInterface $webform_submission, array $context = []) {
// Submission ID is required for logging.
if (empty($webform_submission
->id())) {
return;
}
$message = $context['message'];
unset($context['message']);
$context += [
'uid' => $this->currentUser
->id(),
'webform_submission' => $webform_submission,
'handler_id' => NULL,
'data' => [],
'link' => $webform_submission
->toLink($this
->t('Edit'), 'edit-form')
->toString(),
];
\Drupal::logger('webform_submission')
->notice($message, $context);
}