Skip to content

Commit a216ecb

Browse files
committed
doc: add example for DatadogHandler
1 parent abe594c commit a216ecb

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,41 @@ return [
6868

6969
```
7070

71+
### DatadogHandler
72+
73+
You can adding following block into `config/logging.php`.
74+
75+
```php
76+
use Monolog\Formatter\JsonFormatter;
77+
use Onramplab\LaravelLogEnhancement\Handlers\DatadogHandler;
78+
79+
return [
80+
//...
81+
82+
'channels' => [
83+
//...
84+
85+
'datadog' => [
86+
'driver' => 'monolog',
87+
'level' => 'info',
88+
'handler' => DatadogHandler::class,
89+
'handler_with' => [
90+
'key' => env('DD_LOG_API_KEY'),
91+
'region' => env('DD_LOG_REGION', 'us5'),
92+
'attributes' => [
93+
'hostname' => gethostname(),
94+
'source' => env('DD_LOG_SOURCE', 'laravel'),
95+
'service' => env('DD_LOG_SERVICE'),
96+
'tags' => env('DD_LOG_TAG'),
97+
],
98+
],
99+
'formatter' => JsonFormatter::class,
100+
],
101+
]
102+
];
103+
104+
```
105+
71106
## Testing
72107

73108
Run the tests with:

0 commit comments

Comments
 (0)