DrupalMailHandler.php in Monolog 8
File
src/Logger/Handler/DrupalMailHandler.php
View source
<?php
namespace Drupal\monolog\Logger\Handler;
use Monolog\Handler\MailHandler;
use Monolog\Logger;
class DrupalMailHandler extends MailHandler {
private $to;
public function __construct($to, $level = Logger::ERROR, $bubble = TRUE) {
parent::__construct($level, $bubble);
$this->to = $to;
}
protected function send($content, array $records) {
$mail = \Drupal::service('plugin.manager.mail');
$default_language = \Drupal::languageManager()
->getDefaultLanguage();
$params = [
'content' => $content,
'records' => $records,
];
$mail
->mail('monolog', 'default', $this->to, $default_language
->getName(), $params);
}
}