Skip to content

Commit 4609ac7

Browse files
committed
Merge branch 'master' into 5.6
2 parents 8c94f0c + 42997ab commit 4609ac7

File tree

3 files changed

+384
-364
lines changed

3 files changed

+384
-364
lines changed

README.md

+25-31
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
[![Total Downloads](https://poser.pugx.org/illuminated/console-logger/downloads)](https://packagist.org/packages/illuminated/console-logger)
1010
[![License](https://poser.pugx.org/illuminated/console-logger/license)](https://packagist.org/packages/illuminated/console-logger)
1111

12-
Provides logging and notifications for Laravel console commands.
12+
Logging and notifications for Laravel console commands.
1313

1414
| Laravel | Console Logger |
1515
| ------- | :-----------------------------------------------------------------------: |
@@ -28,7 +28,6 @@ Provides logging and notifications for Laravel console commands.
2828
- [File channel](#file-channel)
2929
- [Notification channels](#notification-channels)
3030
- [Email channel](#email-channel)
31-
- [Slack channel](#slack-channel)
3231
- [Database channel](#database-channel)
3332
- [Error handling](#error-handling)
3433
- [Custom exceptions](#custom-exceptions)
@@ -106,7 +105,7 @@ Log file can be found at `storage/logs/[command-name]/[date].log`. Namespaced co
106105
| `php artisan send-report` | `storage/logs/send-report/[date].log` |
107106
| `php artisan send:report` | `storage/logs/send/report/[date].log` |
108107

109-
As you can see, each command has a separate folder for it's logs. Also, you get configured log files rotation out of the box.
108+
As you can see, each command has a separate folder for its logs. Also, you get configured log files rotation out of the box.
110109
By default, only latest thirty log files are stored. However, you can override this behavior as you wish:
111110

112111
```php
@@ -130,19 +129,19 @@ class ExampleCommand extends Command
130129

131130
## Notification channels
132131

133-
Want to be notified if some kind of an error occurred? Meet notifications!
132+
Want to be notified if some error occurred? Meet notifications!
134133

135134
Notification channels are optional and disabled by default. Each of them can be enabled and configured as needed.
136-
By default, you'll get notifications of each level which is higher than NOTICE (see [PSR-3 log levels](http://www.php-fig.org/psr/psr-3/#5-psr-log-loglevel)).
137-
It means, that you'll get notifications about each NOTICE, WARNING, ERROR, CRITICAL, ALERT and EMERGENCY, occurred while execution.
135+
By default, you'll get notifications of each level which is higher than NOTICE (see [PSR-3 log levels](https://www.php-fig.org/psr/psr-3/#5-psrlogloglevel)).
136+
It means that you'll get notifications about each NOTICE, WARNING, ERROR, CRITICAL, ALERT and EMERGENCY, occurred while execution.
138137

139-
Surely you can change this and other channel-specific aspects as you wish.
138+
Of course, you can change this and other channel-specific aspects as you wish.
140139

141140
### Email channel
142141

143142
Email channel provides notifications via email.
144143

145-
Basically, the only thing you have to do is specify recipients. Set recipients and email notifications are ready to go!
144+
The only thing you have to do is specify recipients. Set recipients and email notifications are ready to go!
146145

147146
```php
148147
class ExampleCommand extends Command
@@ -162,13 +161,13 @@ class ExampleCommand extends Command
162161
```
163162

164163
There is a bunch of methods specific to email channel. If you want to change email notifications level, or change the
165-
subject, or change the from address, or something else - just override proper method as you wish. And you're done!
164+
subject, or change the from address, or something else - override proper method as you wish. And you're done!
166165
167-
Another cool feature of email notifications is deduplication. Sometimes the same error can be produced many-many times.
168-
For example, you're using some kind of external web service which is down. Or imagine that database server goes down.
169-
You'll get a lot of similar emails in those cases. Email notifications deduplication is the solution for those scenarios.
166+
Another cool feature of email notifications is deduplication. Sometimes the same error can be produced many times.
167+
For example, you're using some external web service which is down. Or imagine that database server goes down.
168+
You'll get a lot of similar emails in those cases. Email notifications deduplication is the solution for these scenarios.
170169
171-
Disabled by default, it can be enabled and also adjusted time in seconds, for which deduplication works.
170+
Disabled by default, it can be enabled and also adjusted the time in seconds, for which deduplication works.
172171
173172
```php
174173
class ExampleCommand extends Command
@@ -189,17 +188,11 @@ class ExampleCommand extends Command
189188
}
190189
```
191190
192-
### Slack channel
193-
194-
Slack channel provides notifications via Slack.
195-
196-
This channel is not implemented yet. If you need it, let [me](mailto:[email protected]) know and I'll try to make it faster.
197-
198191
### Database channel
199192
200193
Database channel provides saving of notifications into the database.
201194
202-
Disabled by default, it can be easily enabled be the proper method.
195+
Disabled by default, it can be easily enabled by the proper method.
203196
204197
```php
205198
class ExampleCommand extends Command
@@ -216,8 +209,8 @@ class ExampleCommand extends Command
216209
```
217210
218211
By default, you will get `iclogger_notifications` table, which would be created automatically, if it doesn't exist yet.
219-
Surely, you can change the table name or even the logic of notification saving by overriding proper methods. It can be
220-
useful if you want to add some custom fields to notifications table. Here is the basic example of what it may look like:
212+
Of course, you can change the table name or even the logic of notification saving by overriding proper methods. It can be
213+
useful if you want to add some custom fields to the notifications table. Here is the basic example of what it may look like:
221214

222215
```php
223216
class ExampleCommand extends Command
@@ -299,7 +292,7 @@ array:5 [
299292

300293
## Guzzle 6+ integration
301294

302-
If you're using [Guzzle](https://github.com/guzzle/guzzle), well, maybe you'll want to have logs of your http interactions.
295+
If you're using [Guzzle](https://github.com/guzzle/guzzle), well, maybe you'll want to have logs of your HTTP interactions.
303296

304297
There is a helper function `iclogger_guzzle_middleware`, which makes it very easy:
305298

@@ -318,11 +311,11 @@ $client = new Client([
318311
```
319312

320313
Now, your guzzle interactions are fully loggable. Each request, response and even errors would be logged for you.
321-
You can also set type, as a second argument. Set it to `json` to get auto json decoding for request params and response body.
314+
You can also set type, as a second argument. Set it to `json` to get auto JSON decoding for request params and response body.
322315

323316
And even more advanced options are the third and the fourth optional arguments, which are callbacks, by which you can customize your logging logic if needed.
324-
Both of them should return bool. `shouldLogRequest` determines if request bodies should be logged or not, and `shouldLogResponse` determines the same for the response bodies.
325-
You can set any of your custom logic here. For example, maybe you want to skip logging for just specific urls, or maybe you want to check content length of the response, etc.
317+
Both of them should return a bool. `shouldLogRequest` determines if request bodies should be logged or not, and `shouldLogResponse` determines the same for the response bodies.
318+
You can set any of your custom logic here. For example, maybe you want to skip logging for just specific URLs, or maybe you want to check the content length of the response, etc.
326319

327320
```php
328321
use Psr\Http\Message\RequestInterface;
@@ -349,7 +342,7 @@ $middleware = iclogger_guzzle_middleware($log, 'json',
349342
350343
## Powered by Monolog
351344
352-
This package is using [Monolog logging library](https://github.com/Seldaek/monolog) with all of it's power and benefits.
345+
This package is using the [Monolog logging library](https://github.com/Seldaek/monolog) with all of its power and benefits.
353346
354347
If needed, you may access the underlying Monolog instance in a two ways:
355348
@@ -415,7 +408,8 @@ class ExampleCommand extends Command
415408
416409
### Several traits conflict?
417410
418-
If you're using some other cool `illuminated/console-%` packages, well, then you can find yourself getting "traits conflict".
411+
If you're using another `illuminated/console-%` package, then you can find yourself getting into the "traits conflict".
412+
419413
For example, if you're trying to build loggable command, which is [protected against overlapping](https://github.com/dmitry-ivanov/laravel-console-mutex):
420414
421415
```php
@@ -428,10 +422,10 @@ class ExampleCommand extends Command
428422
}
429423
```
430424
431-
You'll get fatal error, the "traits conflict", because both of these traits are overriding `initialize` method.
432-
>If two traits insert a method with the same name, a fatal error is produced, if the conflict is not explicitly resolved.
425+
You'll get the fatal error - the traits conflict, because of both of these traits are overriding `initialize` method:
426+
> If two traits insert a method with the same name, a fatal error is produced, if the conflict is not explicitly resolved.
433427
434-
But don't worry, solution is very simple. Override `initialize` method by yourself, and initialize traits in required order:
428+
Override `initialize` method by yourself, and initialize traits in required order:
435429
436430
```php
437431
class ExampleCommand extends Command

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "illuminated/console-logger",
3-
"description": "Provides logging and notifications for Laravel console commands.",
3+
"description": "Logging and notifications for Laravel console commands.",
44
"keywords": ["laravel", "console", "command", "logger", "notification", "email", "slack", "database"],
55
"license": "MIT",
66
"authors": [

0 commit comments

Comments
 (0)