Skip to content

Commit be232a8

Browse files
committed
Merge pull request #52 from sdebacker/patch-1
Syntax highlighting + a namespace
2 parents 9ef95ce + dea6c9e commit be232a8

File tree

1 file changed

+39
-23
lines changed

1 file changed

+39
-23
lines changed

README.md

Lines changed: 39 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,21 @@ Installation
1212

1313
Install using composer:
1414

15-
composer require jenssegers/rollbar
15+
```
16+
composer require jenssegers/rollbar
17+
```
1618

1719
Add the service provider to the `'providers'` array in `config/app.php`:
1820

19-
Jenssegers\Rollbar\RollbarServiceProvider::class,
21+
```php
22+
Jenssegers\Rollbar\RollbarServiceProvider::class,
23+
```
2024

2125
If you only want to enable Rollbar reporting for certain environments you can conditionally load the service provider in your `AppServiceProvider`:
2226

2327
```php
2428
if ($this->app->environment('production')) {
25-
$this->app->register(Jenssegers\Rollbar\RollbarServiceProvider::class);
29+
$this->app->register(\Jenssegers\Rollbar\RollbarServiceProvider::class);
2630
}
2731
```
2832

@@ -31,10 +35,12 @@ Configuration
3135

3236
This package supports configuration through the services configuration file located in `config/services.php`. All configuration variables will be directly passed to Rollbar:
3337

34-
'rollbar' => array(
35-
'access_token' => env('ROLLBAR_TOKEN'),
36-
'level' => env('ROLLBAR_LEVEL'),
37-
),
38+
```php
39+
'rollbar' => [
40+
'access_token' => env('ROLLBAR_TOKEN'),
41+
'level' => env('ROLLBAR_LEVEL'),
42+
],
43+
```
3844

3945
The level variable defines the minimum log level at which log messages are sent to Rollbar. For development you could set this either to `debug` to send all log messages, or to `none` to sent no messages at all. For production you could set this to `error` so that all info and debug messages are ignored.
4046

@@ -43,36 +49,46 @@ Usage
4349

4450
To automatically monitor exceptions, simply use the `Log` facade in your error handler in `app/Exceptions/Handler.php`:
4551

46-
public function report(Exception $e)
47-
{
48-
\Log::error($e);
52+
```php
53+
public function report(Exception $e)
54+
{
55+
\Log::error($e);
56+
return parent::report($e);
57+
}
58+
```
4959

50-
return parent::report($e);
51-
}
5260

5361
For Laravel 4 installations, this is located in `app/start/global.php`:
5462

55-
App::error(function(Exception $exception, $code)
56-
{
57-
Log::error($exception);
58-
});
63+
```php
64+
App::error(function(Exception $exception, $code)
65+
{
66+
Log::error($exception);
67+
});
68+
```
5969

6070
Your other log messages will also be sent to Rollbar:
6171

62-
\Log::debug('Here is some debug information');
72+
```php
73+
\Log::debug('Here is some debug information');
74+
```
6375

6476
*NOTE*: Fatal exceptions will always be sent to Rollbar.
6577

6678
### Context informaton
6779

6880
You can pass user information as context like this:
6981

70-
\Log::error('Something went wrong', [
71-
'person' => ['id' => 123, 'username' => 'John Doe', 'email' => '[email protected]']
72-
]);
82+
```php
83+
\Log::error('Something went wrong', [
84+
'person' => ['id' => 123, 'username' => 'John Doe', 'email' => '[email protected]']
85+
]);
86+
```
7387

7488
Or pass some extra information:
7589

76-
\Log::warning('Something went wrong', [
77-
'download_size' => 3432425235
78-
]);
90+
```php
91+
\Log::warning('Something went wrong', [
92+
'download_size' => 3432425235
93+
]);
94+
```

0 commit comments

Comments
 (0)