You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As you can see, each command has a separate folder forit's logs. Also, you get configured log files rotation out of the box.
108
+
As you can see, each command has a separate folder forits logs. Also, you get configured log files rotation out of the box.
110
109
By default, only latest thirty log files are stored. However, you can override this behavior as you wish:
111
110
112
111
```php
@@ -130,19 +129,19 @@ class ExampleCommand extends Command
130
129
131
130
## Notification channels
132
131
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!
134
133
135
134
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.
138
137
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.
140
139
141
140
### Email channel
142
141
143
142
Email channel provides notifications via email.
144
143
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!
146
145
147
146
```php
148
147
class ExampleCommand extends Command
@@ -162,13 +161,13 @@ class ExampleCommand extends Command
162
161
```
163
162
164
163
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!
166
165
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 forthose 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.
170
169
171
-
Disabled by default, it can be enabled and also adjusted timein seconds, for which deduplication works.
170
+
Disabled by default, it can be enabled and also adjusted the time in seconds, for which deduplication works.
172
171
173
172
```php
174
173
class ExampleCommand extends Command
@@ -189,17 +188,11 @@ class ExampleCommand extends Command
189
188
}
190
189
```
191
190
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
-
198
191
### Database channel
199
192
200
193
Database channel provides saving of notifications into the database.
201
194
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.
203
196
204
197
```php
205
198
class ExampleCommand extends Command
@@ -216,8 +209,8 @@ class ExampleCommand extends Command
216
209
```
217
210
218
211
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:
221
214
222
215
```php
223
216
class ExampleCommand extends Command
@@ -299,7 +292,7 @@ array:5 [
299
292
300
293
## Guzzle 6+ integration
301
294
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.
303
296
304
297
There is a helper function`iclogger_guzzle_middleware`, which makes it very easy:
305
298
@@ -318,11 +311,11 @@ $client = new Client([
318
311
```
319
312
320
313
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.
322
315
323
316
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 returna 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.
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.
353
346
354
347
If needed, you may access the underlying Monolog instance in a two ways:
355
348
@@ -415,7 +408,8 @@ class ExampleCommand extends Command
415
408
416
409
### Several traits conflict?
417
410
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
+
419
413
For example, if you're trying to build loggable command, which is [protected against overlapping](https://github.com/dmitry-ivanov/laravel-console-mutex):
420
414
421
415
```php
@@ -428,10 +422,10 @@ class ExampleCommand extends Command
428
422
}
429
423
```
430
424
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.
433
427
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:
0 commit comments