designmynight / laravel-log-mailer
一个用于支持在Laravel中通过电子邮件进行日志记录的包
v2.0.0
2023-11-01 15:37 UTC
Requires
- illuminate/support: ^6.0
This package is auto-updated.
Last update: 2024-08-30 01:14:27 UTC
README
一个服务提供者,用于添加使用Laravel内置邮件提供者通过电子邮件进行日志记录的支持
目录
安装
使用composer安装
composer require designmynight/laravel-log-mailer
Laravel版本兼容性
并在config/app.php
中添加服务提供者
DesignMyNight\Laravel\Logging\MailableLogServiceProvider::class,
对于与Lumen一起使用,请在bootstrap/app.php
中添加服务提供者。
$app->register(DesignMyNight\Laravel\Logging\MailableLogServiceProvider::class);
配置
大多数配置选项可以由环境变量或config/mailablelog.php自动填充,要生成它,请运行php artisan vendor:publish。
为了确保所有未处理的异常都通过邮件发送,请设置邮件日志通道并将其添加到config/logging.php中的日志堆栈中
'channels' => [ 'stack' => [ 'driver' => 'stack', // Add mail to the stack: 'channels' => ['single', 'mail'], ], // ... // Create a mail logging channel: 'mail' => [ 'driver' => 'mail', // Specify who to mail the log to 'to' => [ [ 'address' => 'errors@designmynight.com', 'name' => 'Error' ] ], // Optionally specify who the log mail was sent by // This is overidable in config/mailablelog.php and // falls back to your global from in config/mail.php 'from' => [ 'address' => 'errors@designmynight.com', 'name' => 'Errors' ], // Optionally overwrite the mailable template // 'mailable' => NewLogMailable::class ], ],
您可以指定多个通道,并为每个通道指定收件人和自定义电子邮件模板。