File tree Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Expand file tree Collapse file tree 2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ Add these lines to your `config/services.php`:
27
27
'recipients' => 'email',
28
28
'level' => Monolog\Logger::INFO,
29
29
'propagate' => true,
30
+ 'env' => ['staging', 'production'],
30
31
],
31
32
```
32
33
@@ -37,6 +38,7 @@ Here are the variables references:
37
38
* ` recipients ` : Can either be 1 email address, or an array of email addresses.
38
39
* ` level ` : Minimum level to take care. The default is ` Monolog\Logger:INFO ` .
39
40
* ` propagate ` : When ` false ` , if a record is handled, it won't be propagated to other handlers.
41
+ * ` env ` : Can either be 1 environment name (like ` production ` ) or an array of environment name.
40
42
41
43
Then, add this line to Laravel's ` config/app.php ` , inside the ` providers ` array:
42
44
Original file line number Diff line number Diff line change @@ -17,13 +17,15 @@ public function boot()
17
17
{
18
18
parent ::boot ();
19
19
20
- $ monolog = Log::getMonolog ();
21
- $ monolog ->pushHandler (new PushbulletHandler (
22
- config ('services.monobullet.token ' ),
23
- config ('services.monobullet.recipients ' ),
24
- config ('services.monobullet.level ' , Logger::INFO ),
25
- config ('services.monobullet.propagate ' , true )
26
- ));
20
+ if (in_array (config ('app.env ' ), (array ) config ('services.monobullet.env ' , config ('app.env ' )))) {
21
+ $ monolog = Log::getMonolog ();
22
+ $ monolog ->pushHandler (new PushbulletHandler (
23
+ config ('services.monobullet.token ' ),
24
+ config ('services.monobullet.recipients ' ),
25
+ config ('services.monobullet.level ' , Logger::INFO ),
26
+ config ('services.monobullet.propagate ' , true )
27
+ ));
28
+ }
27
29
}
28
30
29
31
/**
You can’t perform that action at this time.
0 commit comments