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 33
44- ...
55
6+
7+ 0.9.1
8+ -----
9+
10+ - Allow setting custom formatter for the log channel. (#145)
11+
6120.9.0
713-----
814
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
230230This ID can be searched for in the Sentry interface allowing you to find the error quickly.
231231
232232
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+
233274## Resolve name conflicts with packages also called Sentry
234275
235276To 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)
2121 isset ($ config ['bubble ' ]) ? $ config ['bubble ' ] : true
2222 );
2323
24- return new Logger ($ this ->parseChannel ($ config ), [$ this ->prepareHandler ($ handler )]);
24+ return new Logger ($ this ->parseChannel ($ config ), [$ this ->prepareHandler ($ handler, $ config )]);
2525 }
2626}
You can’t perform that action at this time.
0 commit comments