class DrupalMailHandler in Monolog 8
Same name and namespace in other branches
- 2.x src/Logger/Handler/DrupalMailHandler.php \Drupal\monolog\Logger\Handler\DrupalMailHandler
Class DrupalMailHandler.
Hierarchy
- class \Drupal\monolog\Logger\Handler\DrupalMailHandler extends \Monolog\Handler\MailHandler
Expanded class hierarchy of DrupalMailHandler
File
- src/
Logger/ Handler/ DrupalMailHandler.php, line 11
Namespace
Drupal\monolog\Logger\HandlerView source
class DrupalMailHandler extends MailHandler {
private $to;
/**
* DrupalMailHandler constructor.
*
* @param $to
* @param int $level
* @param bool $bubble
*/
public function __construct($to, $level = Logger::ERROR, $bubble = TRUE) {
parent::__construct($level, $bubble);
$this->to = $to;
}
/**
* {@inheritdoc}
*/
protected function send($content, array $records) {
/** @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' => $content,
'records' => $records,
];
$mail
->mail('monolog', 'default', $this->to, $default_language
->getName(), $params);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DrupalMailHandler:: |
private | property | ||
DrupalMailHandler:: |
protected | function | ||
DrupalMailHandler:: |
public | function | DrupalMailHandler constructor. |