henrotaym/laravel-flare-exception-handler

Simple exception handler logging exception context to flare.

v3.1.0 2023-10-12 08:57 UTC

This package is auto-updated.

Last update: 2024-05-12 10:21:12 UTC


README

Compatibility

Version de laravel Version du package
7.x.x 1.x.x
8.x.x 2.x.x
9.x.x 2.x.x
10.x.x 3.x.x

Installation

composer require henrotaym/laravel-flare-exception-handler

Configuration

Environment

LOG_CHANNEL=flare

Usage

Prior to v3.x.x

Your application Handler.php should look like this

namespace App\Exceptions;

use Henrotaym\LaravelFlareExceptionHandler\FlareExceptionHandler;

class Handler extends FlareExceptionHandler
{
    
}

If you need more control, override register method from handler and call this method where needed :

    /**
    * Reporting exception context to flare.
    * 
    * @param Throwable $e
    * @return void
    */
    protected function reportContextToFlare(Throwable $e);

v3.x.x

namespace App\Exceptions;

use Henrotaym\LaravelFlareExceptionHandler\Context\FlareContext;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;

class Handler extends ExceptionHandler
{
    public function register()
    {
        // Add this line to report context to flare
        $this->reportable(FlareContext::report());
    }
}