timetorock / laravel-monolog-sentry by timetorock

Laravel 5.4 library for integration Monolog with Sentry
2,097
2
2
Package Data
Maintainer Username: timetorock
Maintainer Contact: alejandronat@gmail.com (Aleksandr Natalenko)
Package Create Date: 2017-05-14
Package Last Update: 2019-02-11
Language: PHP
License: MIT
Last Refreshed: 2024-11-17 03:01:48
Package Statistics
Total Downloads: 2,097
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 2
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

Monolog Sentry for Laravel 5.x

Software License

Laravel 5.x library for integration Monolog errors with Sentry sentry-laravel.

This library implies already installed sentry-laravel.

Installation

Go to the root of your Laravel project and run the following command:

Laravel 5.4 or earlier:

composer require timetorock/laravel-monolog-sentry 1.3

Laravel 5.5+:

composer require timetorock/laravel-monolog-sentry

Laravel 5.4 or earlier

(Service will be auto-discovered by Laravel 5.5+)

Then in your config/app.php add the MonologSentryServiceProvider to your providers array

'providers' => array(

    ...
    Timetorock\LaravelMonologSentry\Providers\MonologSentryServiceProvider::class,
),

Configuration

Your config/sentry.php file must have DSN from your Sentry project.

'dsn'     => 'https://***:***@sentry.yourdomain.com/{project}'

You can configure Raven through the config/sentry.php config file. All the available options are already in there together with their default values.

You can find more details about the available options in Raven using this link:

https://github.com/getsentry/raven-php#configuration

By default notification would be send for warning level and more.

You can change log level with sentry.level config option, must be a Monolog number.

Monolog\Logger levels:

    DEBUG = 100;
    INFO = 200;
    NOTICE = 250;
    WARNING = 300;
    ERROR = 400;
    CRITICAL = 500;
    ALERT = 550;
    EMERGENCY = 600;

Testing

To test if your Sentry application is correctly grabbing your logs, simply launch php artisan tinker and execute a sample log like so:

$ php artisan tinker
>>> Log::error("This is a test error. Sentry should get this.");

Security

If you discover any security related issues, please email alejandronat@gmail.com or use the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.