Skip to content

Commit b68e822

Browse files
authored
Merge pull request #8 from understand/readme-update
describe use of .env variables
2 parents fb0aff3 + c2e2cb5 commit b68e822

File tree

1 file changed

+28
-25
lines changed

1 file changed

+28
-25
lines changed

README.md

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,23 @@ This packages provides a full abstraction for Understand.io and provides extra f
2828
'Understand\UnderstandLaravel5\UnderstandLaravel5ServiceProvider',
2929
```
3030
31-
3. Publish configuration file
32-
33-
```
34-
php artisan vendor:publish --provider="Understand\UnderstandLaravel5\UnderstandLaravel5ServiceProvider"
35-
```
36-
37-
4. Set your input key in config file (```config/understand-laravel.php```)
31+
3. Set Understand.io input key in your `.env` file
3832
3933
```php
40-
'token' => 'my-input-token'
34+
UNDERSTAND_TOKEN=your-input-token-from-understand-io
4135
```
4236
43-
5. Send your first event
37+
4. Send your first event
4438
4539
```php
4640
// anywhere inside your Laravel app
4741
\Log::info('Understand.io test');
4842
```
4943
50-
6. If you are using Laravel 5.0 (`>= 5.0, < 5.1`) version, please read about - [how to report Laravel 5.0 exceptions](#how-to-report-laravel-50--50--51-exceptions).
44+
- We recommend that you make use of a async handler - [How to send data asynchronously](#how-to-send-data-asynchronously)
45+
- If you are using Laravel 5.0 (`>= 5.0, < 5.1`) version, please read about - [How to report Laravel 5.0 exceptions](#how-to-report-laravel-50--50--51-exceptions).
46+
- For advanced configuration please read about - [Advanced configuration](#advanced-configuration)
47+
5148
5249
### How to send events/logs
5350
@@ -181,16 +178,14 @@ This additional meta data will then be automatically appended to all of your Lar
181178
### How to send data asynchronously
182179

183180
##### Async handler
184-
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 async handler. To do this, change the config parameter `handler` to `async`.
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 async handler. To do this, set the config parameter `UNDERSTAND_HANDLER` to `async` in your `.env` file.
185182

186183
```php
187-
/**
188-
* Specify which handler to use - sync, queue or async.
189-
*
190-
* Note that the async handler will only work in systems where
191-
* the CURL command line tool is installed
192-
*/
193-
'handler' => 'async',
184+
# Specify which handler to use - sync, queue or async.
185+
#
186+
# Note that the async handler will only work in systems where
187+
# the CURL command line tool is installed
188+
UNDERSTAND_HANDLER=async
194189
```
195190

196191
The async handler is supported in most of the systems - the only requirement is that CURL command line tool is installed and functioning correctly. To check whether CURL is available on your system, execute following command in your console:
@@ -223,28 +218,36 @@ Laravel's (`>= 5.0, < 5.1`) exception logger doesn't use event dispatcher (https
223218

224219

225220

226-
### Configuration
221+
### Advanced Configuration
222+
223+
224+
1. Publish configuration file
225+
226+
```
227+
php artisan vendor:publish --provider="Understand\UnderstandLaravel5\UnderstandLaravel5ServiceProvider"
228+
```
229+
230+
2. And you can now make adjustments in your ```config/understand-laravel.php``` file
227231
228232
```php
229233
return [
230-
231234
/**
232235
* Input key
233236
*/
234-
'token' => 'your-input-token-from-understand-io',
235-
237+
'token' => env('UNDERSTAND_TOKEN'),
238+
236239
/**
237240
* Specifies whether logger should throw an exception of issues detected
238241
*/
239242
'silent' => true,
240-
243+
241244
/**
242245
* Specify which handler to use - sync, queue or async.
243246
*
244247
* Note that the async handler will only work in systems where
245248
* the CURL command line tool is installed
246249
*/
247-
'handler' => 'sync',
250+
'handler' => env('UNDERSTAND_HANDLER', 'sync'),
248251
249252
'log_types' => [
250253
'eloquent_log' => [
@@ -268,6 +271,7 @@ return [
268271
'env' => 'UnderstandFieldProvider::getEnvironment',
269272
'url' => 'UnderstandFieldProvider::getUrl',
270273
'method' => 'UnderstandFieldProvider::getRequestMethod',
274+
'client_ip' => 'UnderstandFieldProvider::getClientIp',
271275
]
272276
],
273277
'exception_log' => [
@@ -284,7 +288,6 @@ return [
284288
]
285289
]
286290
]
287-
288291
];
289292
```
290293

0 commit comments

Comments
 (0)