2017 © Pedro Peláez
 

library raven

Sentry (Raven) error monitoring integration for Laravel projects

image

jenssegers/raven

Sentry (Raven) error monitoring integration for Laravel projects

  • Saturday, February 25, 2017
  • by jenssegers
  • Repository
  • 4 Watchers
  • 90 Stars
  • 147,465 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 16 Forks
  • 5 Open issues
  • 25 Versions
  • 2 % Grown

The README.md

Laravel Raven

Build Status Coverage Status, (*1)

Sentry (Raven) error monitoring integration for Laravel projects. This library adds a listener to Laravel's logging component. Laravel's auth and session information will be sent in to Sentry's user context, as well as some other helpful tags such as 'environment', 'server', 'php_version' and 'ip'., (*2)

rollbar, (*3)

Installation

Install using composer:, (*4)

composer require jenssegers/raven

Add the service provider in app/config/app.php:, (*5)

Jenssegers\Raven\RavenServiceProvider::class,

If you only want to enable Sentry reporting for certain environments you can conditionally load the service provider in your AppServiceProvider:, (*6)

if ($this->app->environment('production')) {
    $this->app->register(Jenssegers\Raven\RavenServiceProvider::class);
}

Optional: register the Raven alias:, (*7)

'Raven'           => Jenssegers\Raven\Facades\Raven::class,

Configuration

This package supports configuration through environment variables and/or the services configuration file located in app/config/services.php:, (*8)

'raven' => [
    'dsn'   => env('RAVEN_DSN'),
    'level' => env('LOG_LEVEL'),
],

The level variable defines the minimum log level at which log messages are sent to Sentry. 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., (*9)

For more information about the possible configuration variables, check https://github.com/getsentry/raven-php, (*10)

Usage in Laravel

In Laravel, the service provider will automatically hook into Laravel's logger and send all messages matching the log level to Sentry., (*11)

If you want to send exceptions to Sentry, simply use the Log facade:, (*12)

try {
    something();
} catch (\Exception $e) {
    Log::error($e);
}

For logging messages or exceptions, you can any of these methods: debug, notice, warning, error, critical, alert or emergency., (*13)

Log::debug('Here is some debug information');

Alternative usage

If you prefer dependency injection rather than calling the Log facade, you can typehint the Jenssegers\Raven\RavenHandler class in your controller methods:, (*14)

use Jenssegers\Raven\RavenHandler as Raven;

...

public function index(Request $request, Raven $raven)
{
    Raven::info('Request received!');
}

Context informaton

The included context builder will automatically collect information about the current logged in user and the session information. If can pass additional user context information like this:, (*15)

Log::error('Something went wrong', [
    'user' => ['name' => 'John Doe', 'email' => 'john@doe.com']
]);

Or pass additional tags:, (*16)

Log::info('Task completed', [
    'tags' => ['state' => 1234]
]);

Or pass some extra information:, (*17)

Log::warning('Something went wrong', [
    'download_size' => 3432425235
]);

Usage in Lumen

Because Lumen uses a different way of handling logging, the service provider is unable to intercept actual exceptions. Instead you can use the included Raven facade. First add the following to your bootstrap/app.php:, (*18)

$app->register(Jenssegers\Raven\RavenServiceProvider::class);

Then add this to your exception handler in app/Exceptions/Handler.php:, (*19)

use Jenssegers\Raven\Facades\Raven;

And:, (*20)

public function report(Exception $e)
{
    if ($this->shouldReport($e)) {
        Raven::error($e);
    }

    parent::report($e);
}

The Versions

25/02 2017

dev-master

9999999-dev https://github.com/jenssegers/laravel-raven

Sentry (Raven) error monitoring integration for Laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel logging raven sentry error monitoring getsentry

25/02 2017

v1.11.0

1.11.0.0 https://github.com/jenssegers/laravel-raven

Sentry (Raven) error monitoring integration for Laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel logging raven sentry error monitoring getsentry

25/02 2017

v1.10.0

1.10.0.0 https://github.com/jenssegers/laravel-raven

Sentry (Raven) error monitoring integration for Laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel logging raven sentry error monitoring getsentry

27/10 2016

v1.9.0

1.9.0.0 https://github.com/jenssegers/laravel-raven

Sentry (Raven) error monitoring integration for Laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel logging raven sentry error monitoring getsentry

15/05 2016

v1.8.0

1.8.0.0 https://github.com/jenssegers/laravel-raven

Sentry (Raven) error monitoring integration for Laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel logging raven sentry error monitoring getsentry

03/05 2016

v1.7.1

1.7.1.0 https://github.com/jenssegers/laravel-raven

Sentry (Raven) error monitoring integration for Laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel logging raven sentry error monitoring getsentry

10/04 2016

v1.7.0

1.7.0.0 https://github.com/jenssegers/laravel-raven

Sentry (Raven) error monitoring integration for Laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel logging raven sentry error monitoring getsentry

10/04 2016

v1.6.1

1.6.1.0 https://github.com/jenssegers/laravel-raven

Sentry (Raven) error monitoring integration for Laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel logging raven sentry error monitoring getsentry

10/04 2016

v1.6.0

1.6.0.0 https://github.com/jenssegers/laravel-raven

Sentry (Raven) error monitoring integration for Laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel logging raven sentry error monitoring getsentry

10/04 2016

v1.5.1

1.5.1.0 https://github.com/jenssegers/laravel-raven

Sentry (Raven) error monitoring integration for Laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel logging raven sentry error monitoring getsentry

20/03 2016

v1.5.0

1.5.0.0 https://github.com/jenssegers/laravel-raven

Sentry (Raven) error monitoring integration for Laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel logging raven sentry error monitoring getsentry

30/05 2015

v1.4.5

1.4.5.0

Sentry (Raven) error monitoring integration for Laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel logging raven sentry error monitoring getsentry

30/05 2015

v1.4.4

1.4.4.0

Sentry (Raven) error monitoring integration for Laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel logging raven sentry error monitoring getsentry

30/05 2015

v1.4.3

1.4.3.0

Sentry (Raven) error monitoring integration for Laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel logging raven sentry error monitoring getsentry

30/05 2015

v1.4.2

1.4.2.0

Sentry (Raven) error monitoring integration for Laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel logging raven sentry error monitoring getsentry

09/05 2015

v1.4.1

1.4.1.0

Sentry (Raven) error monitoring integration for Laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel logging raven sentry error monitoring getsentry

09/05 2015

v1.4.0

1.4.0.0

Sentry (Raven) error monitoring integration for Laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel logging raven sentry error monitoring getsentry

19/04 2015

v1.3.1

1.3.1.0

Sentry (Raven) error monitoring integration for Laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel logging raven sentry error monitoring getsentry

16/12 2014

v1.3.0

1.3.0.0

Sentry (Raven) error monitoring integration for Laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel logging raven sentry error monitoring getsentry

15/06 2014

v1.2.2

1.2.2.0

Sentry (Raven) error monitoring integration for Laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel logging raven sentry error monitoring getsentry

10/06 2014

v1.2.1

1.2.1.0

Sentry (Raven) error monitoring integration for Laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel logging raven sentry error monitoring getsentry

04/05 2014

v1.2.0

1.2.0.0

Sentry (Raven) error monitoring integration for Laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel logging raven sentry error monitoring getsentry

02/05 2014

v1.1.0

1.1.0.0

Sentry (Raven) error monitoring integration for Laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel logging raven sentry error monitoring getsentry

02/05 2014

v1.0.1

1.0.1.0

Sentry (Raven) error monitoring integration for Laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel logging raven sentry error monitoring getsentry

02/05 2014

v1.0.0

1.0.0.0

Sentry (Raven) error monitoring integration for Laravel projects

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel logging raven sentry error monitoring getsentry