public static function configureEmails(Monolog $monolog, $emailAddresses, $emailSubject) { if (!empty($emailAddresses)) { $senderEmail = config('logging.email_sender_address') ?: false; if (empty($senderEmail)) { $senderEmail = 'errors@' . (empty($_SERVER['HTTP_HOST']) ? 'unknown.host' : $_SERVER['HTTP_HOST']); } $mail = new NativeMailerHandler($emailAddresses, $emailSubject, $senderEmail, config('logging.log_level', Logger::WARNING)); $mail->setFormatter(new HtmlFormatter()); $mail->pushProcessor(new WebProcessor()); $mail->pushProcessor(new IntrospectionProcessor(Logger::DEBUG)); $mail->setContentType('text/html'); $monolog->pushHandler($mail); } }