You are here

protected function DrupalMailHandler::send in Monolog 2.x

Same name and namespace in other branches
  1. 8 src/Logger/Handler/DrupalMailHandler.php \Drupal\monolog\Logger\Handler\DrupalMailHandler::send()

File

src/Logger/Handler/DrupalMailHandler.php, line 32

Class

DrupalMailHandler
Class DrupalMailHandler.

Namespace

Drupal\monolog\Logger\Handler

Code

protected function send(string $content, array $records) : void {

  /** @var \Drupal\Core\Mail\MailManagerInterface $mail */
  $mail = \Drupal::service('plugin.manager.mail');

  /** @var \Drupal\Core\Language\LanguageInterface $default_language */
  $default_language = \Drupal::languageManager()
    ->getDefaultLanguage();
  $params = [
    'content' => Markup::create($content),
    'records' => $records,
  ];
  $mail
    ->mail('monolog', 'default', $this->to, $default_language
    ->getName(), $params);
}