Skip to content

brucewu16899/laravel-raven

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Raven

Sentry (Raven) error monitoring for Laravel 4 & 5 with send in background using queues

Build Status Scrutinizer Code Quality Coverage Status License Latest Version Total Downloads

Sentry (Raven) error monitoring for Laravel 5 with send in background using queues. This will add a listener to Laravel's existing log system. It makes use to Laravel's queues to push messages into the background without slowing down the application.

rollbar

Installation

Add the package to your composer.json and run composer update.

{
    "require": {
        "clowdy/laravel-raven": "2.*"
    }
}

Add the service provider in config/app.php:

'Clowdy\Raven\RavenServiceProvider',

Register the Raven alias:

'Raven' => 'Clowdy\Raven\Facades\Raven',

You also need to modify app\Exceptions\Hander.php to extend Clowdy\Raven\Handler instead of Illuminate\Foundation\Exceptions\Handler as below:

<?php namespace app\Exceptions;

use Exception;
// use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Clowdy\Raven\Handler as ExceptionHandler;

class Handler extends ExceptionHandler

Looking for a Laravel 4 compatible version?

Checkout the 1.0 branch

Configuration

Publish the included configuration file:

$ php artisan vendor:publish --provider="clowdy\laravel-raven\RavenServiceProvider" --tag="config"

Change the Sentry DSN by using the RAVEN_DSN env variable or changing the config file:

RAVEN_DSN=your-raven-dsn

This library uses the queue system, make sure your config/queue.php file is configured correctly. You can also specify the connection and the queue to use in the raven config. Connection must exist in config/queue.php and a custom queue can be defined. These can be set using the RAVEN_QUEUE_CONNECTION for connection and RAVEN_QUEUE_QUEUE for the custom queue.

RAVEN_QUEUE_CONNECTION=beanstalkd
RAVEN_QUEUE_QUEUE=error

Usage

To monitor exceptions, simply use the Log facade:

Log::error($exception);

You can change the logs used by changing the log level in the config by modifying the env var.

RAVEN_LEVEL=error

Context information

You can pass additional information as context like this:

Log::error('Oops, Something went wrong', [
    'user' => ['name' => $user->name, 'email' => $user->email]
]);

Credits

This package was inspired rcrowe/Raven.

About

Sentry (Raven) error monitoring for Laravel 4 & 5 with send in background

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%