Skip to content

Commit 851507e

Browse files
committed
Merge branch 'master' into releases/0.9.x
# Conflicts: # src/Sentry/SentryLaravel/SentryLaravel.php
2 parents 4b2a43c + b4a19e8 commit 851507e

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

CHANGES

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33

44
- ...
55

6+
7+
0.9.1
8+
-----
9+
10+
- Allow setting custom formatter for the log channel. (#145)
11+
612
0.9.0
713
-----
814

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,47 @@ This could look something like this in for example your `resources/views/error/5
230230
This 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

235276
To resolve this you will need to create your own service provider extending ours so we can prevent naming conflicts.

src/Sentry/SentryLaravel/SentryLogChannel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)