Skip to content

Commit 2d40a3c

Browse files
committed
feat: add Laravel 10 support
1 parent 0ea2a47 commit 2d40a3c

File tree

4 files changed

+175
-171
lines changed

4 files changed

+175
-171
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to `laravel-mail-log-channel` will be documented in this file.
44

5+
## 2.3.0 - 2023-01-17
6+
7+
- Add support for Laravel 10
8+
59
## 2.2.1 - 2023-01-11
610

711
- Fix issue where subjects were empty on content with >255 characters (thanks to @dev-idsys-mi #5)

README.md

Lines changed: 122 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,122 @@
1-
# Laravel Mail Log Channel
2-
3-
4-
[![Latest Stable Version](https://img.shields.io/github/v/release/shaffe-fr/laravel-mail-log-channel.svg)](https://packagist.org/packages/shaffe/laravel-mail-log-channel) [![Total Downloads](https://img.shields.io/packagist/dt/shaffe/laravel-mail-log-channel.svg)](https://packagist.org/packages/shaffe/laravel-mail-log-channel)
5-
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6-
7-
A service provider to add support for logging via email using Laravels built-in mail provider.
8-
9-
This package is a fork of [laravel-log-mailer](https://packagist.org/packages/designmynight/laravel-log-mailer) by Steve Porter.
10-
11-
![image](https://user-images.githubusercontent.com/12199424/45576336-a93c1300-b86e-11e8-9575-d1e4c5ed5dec.png)
12-
13-
## Table of contents
14-
15-
* [Installation](#installation)
16-
* [Configuration](#configuration)
17-
18-
## Installation
19-
20-
You can install this package via composer using this commande:
21-
22-
```sh
23-
composer require shaffe/laravel-mail-log-channel
24-
```
25-
26-
### Laravel version compatibility
27-
28-
Laravel | Package |
29-
:------------|:--------|
30-
6, 7, 8, 9 | ^2.0 |
31-
5.6.x | ^1.0 |
32-
33-
The package will automatically register itself if you use Laravel.
34-
35-
For usage with [Lumen](http://lumen.laravel.com), add the service provider in `bootstrap/app.php`.
36-
37-
```php
38-
$app->register(Shaffe\MailLogChannel\MailLogChannelServiceProvider::class);
39-
```
40-
41-
## Configuration
42-
43-
To ensure all unhandled exceptions are mailed:
44-
45-
1. create a `mail` logging channel in `config/logging.php`,
46-
2. add this `mail` channel to your current logging stack,
47-
3. add a `LOG_MAIL_ADDRESS` to your `.env` file to define the recipient.
48-
49-
You can specify multiple channels and individually change the recipients, the subject and the email template.
50-
51-
```php
52-
'channels' => [
53-
'stack' => [
54-
'driver' => 'stack',
55-
// 2. Add mail to the stack:
56-
'channels' => ['single', 'mail'],
57-
],
58-
59-
// ...
60-
61-
// 1. Create a mail logging channel:
62-
'mail' => [
63-
'driver' => 'mail',
64-
'level' => env('LOG_MAIL_LEVEL', 'notice'),
65-
66-
// Specify mail recipient
67-
'to' => [
68-
[
69-
'address' => env('LOG_MAIL_ADDRESS'),
70-
'name' => 'Error',
71-
],
72-
],
73-
74-
'from' => [
75-
// Defaults to config('mail.from.address')
76-
'address' => env('LOG_MAIL_ADDRESS'),
77-
// Defaults to config('mail.from.name')
78-
'name' => 'Errors'
79-
],
80-
81-
// Optionally overwrite the subject format pattern
82-
// 'subject_format' => env('LOG_MAIL_SUBJECT_FORMAT', '[%datetime%] %level_name%: %message%'),
83-
84-
// Optionally overwrite the mailable template
85-
// Two variables are sent to the view: `string $content` and `array $records`
86-
// 'mailable' => NewLogMailable::class
87-
],
88-
],
89-
```
90-
91-
### Recipients configuration format
92-
93-
The following `to` config formats are supported:
94-
95-
* single email address:
96-
97-
```php
98-
'to' => env('LOG_MAIL_ADDRESS', ''),
99-
```
100-
101-
* array of email addresses:
102-
103-
```php
104-
'to' => explode(',', env('LOG_MAIL_ADDRESS', '')),
105-
```
106-
107-
* associative array of email => name addresses:
108-
109-
```php
110-
'to' => [env('LOG_MAIL_ADDRESS', '') => 'Error'],`
111-
```
112-
113-
* array of email and name:
114-
115-
```php
116-
'to' => [
117-
[
118-
'address' => env('LOG_MAIL_ADDRESS', ''),
119-
'name' => 'Error',
120-
],
121-
],
122-
```
1+
# Laravel Mail Log Channel
2+
3+
4+
[![Latest Stable Version](https://img.shields.io/github/v/release/shaffe-fr/laravel-mail-log-channel.svg)](https://packagist.org/packages/shaffe/laravel-mail-log-channel) [![Total Downloads](https://img.shields.io/packagist/dt/shaffe/laravel-mail-log-channel.svg)](https://packagist.org/packages/shaffe/laravel-mail-log-channel)
5+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6+
7+
A service provider to add support for logging via email using Laravels built-in mail provider.
8+
9+
This package is a fork of [laravel-log-mailer](https://packagist.org/packages/designmynight/laravel-log-mailer) by Steve Porter.
10+
11+
![image](https://user-images.githubusercontent.com/12199424/45576336-a93c1300-b86e-11e8-9575-d1e4c5ed5dec.png)
12+
13+
## Table of contents
14+
15+
* [Installation](#installation)
16+
* [Configuration](#configuration)
17+
18+
## Installation
19+
20+
You can install this package via composer using this commande:
21+
22+
```sh
23+
composer require shaffe/laravel-mail-log-channel
24+
```
25+
26+
### Laravel version compatibility
27+
28+
Laravel | Package |
29+
:----------------|:--------|
30+
6, 7, 8, 9, 10 | ^2.0 |
31+
5.6.x | ^1.0 |
32+
33+
The package will automatically register itself if you use Laravel.
34+
35+
For usage with [Lumen](http://lumen.laravel.com), add the service provider in `bootstrap/app.php`.
36+
37+
```php
38+
$app->register(Shaffe\MailLogChannel\MailLogChannelServiceProvider::class);
39+
```
40+
41+
## Configuration
42+
43+
To ensure all unhandled exceptions are mailed:
44+
45+
1. create a `mail` logging channel in `config/logging.php`,
46+
2. add this `mail` channel to your current logging stack,
47+
3. add a `LOG_MAIL_ADDRESS` to your `.env` file to define the recipient.
48+
49+
You can specify multiple channels and individually change the recipients, the subject and the email template.
50+
51+
```php
52+
'channels' => [
53+
'stack' => [
54+
'driver' => 'stack',
55+
// 2. Add mail to the stack:
56+
'channels' => ['single', 'mail'],
57+
],
58+
59+
// ...
60+
61+
// 1. Create a mail logging channel:
62+
'mail' => [
63+
'driver' => 'mail',
64+
'level' => env('LOG_MAIL_LEVEL', 'notice'),
65+
66+
// Specify mail recipient
67+
'to' => [
68+
[
69+
'address' => env('LOG_MAIL_ADDRESS'),
70+
'name' => 'Error',
71+
],
72+
],
73+
74+
'from' => [
75+
// Defaults to config('mail.from.address')
76+
'address' => env('LOG_MAIL_ADDRESS'),
77+
// Defaults to config('mail.from.name')
78+
'name' => 'Errors'
79+
],
80+
81+
// Optionally overwrite the subject format pattern
82+
// 'subject_format' => env('LOG_MAIL_SUBJECT_FORMAT', '[%datetime%] %level_name%: %message%'),
83+
84+
// Optionally overwrite the mailable template
85+
// Two variables are sent to the view: `string $content` and `array $records`
86+
// 'mailable' => NewLogMailable::class
87+
],
88+
],
89+
```
90+
91+
### Recipients configuration format
92+
93+
The following `to` config formats are supported:
94+
95+
* single email address:
96+
97+
```php
98+
'to' => env('LOG_MAIL_ADDRESS', ''),
99+
```
100+
101+
* array of email addresses:
102+
103+
```php
104+
'to' => explode(',', env('LOG_MAIL_ADDRESS', '')),
105+
```
106+
107+
* associative array of email => name addresses:
108+
109+
```php
110+
'to' => [env('LOG_MAIL_ADDRESS', '') => 'Error'],`
111+
```
112+
113+
* array of email and name:
114+
115+
```php
116+
'to' => [
117+
[
118+
'address' => env('LOG_MAIL_ADDRESS', ''),
119+
'name' => 'Error',
120+
],
121+
],
122+
```

composer.json

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,47 @@
1-
{
2-
"name": "shaffe/laravel-mail-log-channel",
3-
"description": "A package to support logging via email in Laravel",
4-
"homepage": "https://github.com/shaffe-fr/laravel-mail-log-channel",
5-
"license": "MIT",
6-
"keywords": [
7-
"laravel",
8-
"logging",
9-
"mail channel",
10-
"laravel-log-mailer",
11-
"monolog",
12-
"laravel-mail-log-channel",
13-
"shaffe"
14-
],
15-
"require": {
16-
"illuminate/bus": "^5.6|^6.0|^7.0|^8.0|^9.0",
17-
"illuminate/contracts": "^5.6|^6.0|^7.0|^8.0|^9.0",
18-
"illuminate/log": "^5.6|^6.0|^7.0|^8.0|^9.0",
19-
"illuminate/mail": "^5.6|^6.0|^7.0|^8.0|^9.0",
20-
"illuminate/queue": "^5.6|^6.0|^7.0|^8.0|^9.0",
21-
"illuminate/support": "^5.6|^6.0|^7.|^8.00|^9.0"
22-
},
23-
"autoload": {
24-
"psr-4": {
25-
"Shaffe\\MailLogChannel\\": "src"
26-
}
27-
},
28-
"authors": [
29-
{
30-
"name": "Karel FAILLE",
31-
"email": "shaffe.fr@gmail.com",
32-
"role": "Developer"
33-
},
34-
{
35-
"name": "Steve Porter",
36-
"email": "steve@designmynight.com",
37-
"role": "Developer"
38-
}
39-
],
40-
"extra": {
41-
"laravel": {
42-
"providers": [
43-
"Shaffe\\MailLogChannel\\MailLogChannelServiceProvider"
44-
]
45-
}
46-
}
47-
}
1+
{
2+
"name": "shaffe/laravel-mail-log-channel",
3+
"description": "A package to support logging via email in Laravel",
4+
"homepage": "https://github.com/shaffe-fr/laravel-mail-log-channel",
5+
"license": "MIT",
6+
"keywords": [
7+
"laravel",
8+
"logging",
9+
"mail channel",
10+
"laravel-log-mailer",
11+
"monolog",
12+
"laravel-mail-log-channel",
13+
"shaffe"
14+
],
15+
"require": {
16+
"illuminate/bus": "^5.6|^6.0|^7.0|^8.0|^9.0|^10.0",
17+
"illuminate/contracts": "^5.6|^6.0|^7.0|^8.0|^9.0|^10.0",
18+
"illuminate/log": "^5.6|^6.0|^7.0|^8.0|^9.0|^10.0",
19+
"illuminate/mail": "^5.6|^6.0|^7.0|^8.0|^9.0|^10.0",
20+
"illuminate/queue": "^5.6|^6.0|^7.0|^8.0|^9.0|^10.0",
21+
"illuminate/support": "^5.6|^6.0|^7.|^8.00|^9.0|^10.0"
22+
},
23+
"autoload": {
24+
"psr-4": {
25+
"Shaffe\\MailLogChannel\\": "src"
26+
}
27+
},
28+
"authors": [
29+
{
30+
"name": "Karel FAILLE",
31+
"email": "shaffe.fr@gmail.com",
32+
"role": "Developer"
33+
},
34+
{
35+
"name": "Steve Porter",
36+
"email": "steve@designmynight.com",
37+
"role": "Developer"
38+
}
39+
],
40+
"extra": {
41+
"laravel": {
42+
"providers": [
43+
"Shaffe\\MailLogChannel\\MailLogChannelServiceProvider"
44+
]
45+
}
46+
}
47+
}

src/Monolog/Handlers/MailableHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,15 @@ class MailableHandler extends MailHandler
2424
*
2525
* @param \Illuminate\Mail\Mailable $mailable
2626
* @param \Monolog\Formatter\LineFormatter $subjectFormatter
27-
* @param int $level The minimum logging level at which this handler will be triggered
27+
* @param int|string|\Monolog\Level $level The minimum logging level at which this handler will be triggered
2828
* @param bool $bubble Whether the messages that are handled can bubble up the stack or not
2929
*
3030
* @throws \Illuminate\Contracts\Container\BindingResolutionException
3131
*/
3232
public function __construct(
3333
Mailable $mailable,
3434
LineFormatter $subjectFormatter,
35-
int $level = Logger::DEBUG,
35+
$level = Logger::DEBUG,
3636
bool $bubble = true
3737
) {
3838
parent::__construct($level, $bubble);

0 commit comments

Comments
 (0)