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
This packages provides a full abstraction for Understand.io and provides extra features to improve Laravel's default logging capabilities. It is essentially a wrapper around Laravel's event handler to take full advantage of Understand.io's data aggregation and analysis capabilities.
6
11
7
12
### Quick start
8
13
9
-
1. Add this package to your composer.json and run `composer update`:
14
+
1. Add this package to your composer.json
10
15
11
16
```php
12
-
"understand/understand-laravel": "1.*"
17
+
"understand/understand-laravel": "0.0.*"
18
+
```
19
+
20
+
2. Update composer.json packages
21
+
22
+
```
23
+
composer update
13
24
```
14
25
15
-
2. Add the ServiceProvider to the providers array in app/config/app.php
26
+
3. Add the ServiceProvider to the providers array in app/config/app.php
By default, Laravel automatically stores its logs in ```app/storage/logs```. By using this package, your logs can also be sent to your Understand.io channel. This includes error and exception logs, as well as any log events that you have defined (for example, ```Log::info('my custom log')```).
By default, All exceptions will be send to Understand.io service.
38
64
39
65
#### Eloquent model logs
40
66
Eloquent model logs are generated whenever one of the `created`, `updated`, `deleted` or `restored` Eloquent events is fired. This allows you to automatically track all changes to your models and will contain a current model diff (`$model->getDirty()`), the type of event (created, updated, etc) and additonal meta data (user_id, session_id, etc). This means that all model events will be transformed into a log event which will be sent to Understand.io.
41
67
42
68
By default model logs are disabled. To enable model logs, you can set the config value to `true`:
43
69
44
70
```php
45
-
'eloquent_logs' => true,
71
+
'log_types' => [
72
+
'eloquent_log' => [
73
+
'enabled' => true,
46
74
```
47
75
48
76
### Additional meta data (field providers)
@@ -53,7 +81,7 @@ You may wish to capture additional meta data with each event. For example, it ca
53
81
* Specify additional field providers for each log
54
82
* E.g. sha1 version session_id will be appended to each "Log::info('event')"
55
83
*/
56
-
'log_types' => [
84
+
'log_types' => [
57
85
'eloquent_log' => [
58
86
'enabled' => false,
59
87
'meta' => [
@@ -82,7 +110,7 @@ You may wish to capture additional meta data with each event. For example, it ca
@@ -149,7 +177,7 @@ This additional meta data will then be automatically appended to all of your Lar
149
177
```
150
178
151
179
152
-
### How to send data asynchnoously
180
+
### How to send data asynchronously
153
181
By default each log event will be sent to Understand.io's api server directly after the event happens. If you generate a large number of logs, this could slow your app down and, in these scenarios, we recommend that you make use of a queue handler. To do this, change the config parameter `handler` to `queue` and Laravel queues will be automatically used. Bear in mind that by the default Laravel queue is `sync`, so you will still need to configure your queues properly using something like iron.io or Amazon SQS. See http://laravel.com/docs/queues for more information.
0 commit comments