File tree Expand file tree Collapse file tree 3 files changed +48
-1
lines changed Expand file tree Collapse file tree 3 files changed +48
-1
lines changed Original file line number Diff line number Diff line change 3
3
4
4
- ...
5
5
6
+
7
+ 0.9.1
8
+ -----
9
+
10
+ - Allow setting custom formatter for the log channel. (#145)
11
+
6
12
0.9.0
7
13
-----
8
14
Original file line number Diff line number Diff line change @@ -230,6 +230,47 @@ This could look something like this in for example your `resources/views/error/5
230
230
This ID can be searched for in the Sentry interface allowing you to find the error quickly.
231
231
232
232
233
+ ## Using Laravel 5.6 log channels
234
+
235
+ To configure Sentry as a log channel add the following config to the ` channels ` section in ` config/logging.php ` :
236
+
237
+ ``` php
238
+ 'channels' => [
239
+ // ...
240
+ 'sentry' => [
241
+ 'driver' => 'sentry',
242
+ ],
243
+ ],
244
+ ```
245
+
246
+ After you configured the Sentry log channel you can configure your app to both log to a log file and to Sentry by modifiying the log stack:
247
+
248
+ ``` php
249
+ 'channels' => [
250
+ 'stack' => [
251
+ 'driver' => 'stack',
252
+ // Add the Sentry log channel to the stack
253
+ 'channels' => ['single', 'sentry'],
254
+ ],
255
+ //...
256
+ ],
257
+ ```
258
+
259
+ Optionally you can set the logging level and if events should bubble on the driver:
260
+
261
+ ``` php
262
+ 'channels' => [
263
+ // ...
264
+ 'sentry' => [
265
+ 'driver' => 'sentry',
266
+ 'level' => null, // The minimum monolog logging level at which this handler will be triggered
267
+ // For example: `\Monolog\Logger::ERROR`
268
+ 'bubble' => true, // Whether the messages that are handled can bubble up the stack or not
269
+ ],
270
+ ],
271
+ ```
272
+
273
+
233
274
## Resolve name conflicts with packages also called Sentry
234
275
235
276
To resolve this you will need to create your own service provider extending ours so we can prevent naming conflicts.
Original file line number Diff line number Diff line change @@ -21,6 +21,6 @@ public function __invoke(array $config)
21
21
isset ($ config ['bubble ' ]) ? $ config ['bubble ' ] : true
22
22
);
23
23
24
- return new Logger ($ this ->parseChannel ($ config ), [$ this ->prepareHandler ($ handler )]);
24
+ return new Logger ($ this ->parseChannel ($ config ), [$ this ->prepareHandler ($ handler, $ config )]);
25
25
}
26
26
}
You can’t perform that action at this time.
0 commit comments