You are here

protected function WebformHandlerBase::log in Webform 8.5

Log a webform handler's submission operation.

Parameters

\Drupal\webform\WebformSubmissionInterface $webform_submission: A webform submission.

string $operation: The operation to be logged.

string $message: The message to be logged.

array $data: The data to be saved with log record.

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/Plugin/WebformHandlerBase.php, line 881

Class

WebformHandlerBase
Provides a base class for a webform handler.

Namespace

Drupal\webform\Plugin

Code

protected function log(WebformSubmissionInterface $webform_submission, $operation, $message = '', array $data = []) {
  if ($webform_submission
    ->getWebform()
    ->hasSubmissionLog()) {
    $this->submissionStorage
      ->log($webform_submission, [
      'handler_id' => $this
        ->getHandlerId(),
      'operation' => $operation,
      'message' => $message,
      'data' => $data,
    ]);
  }
}