henrotaym/laravel-flare-exception-handler

Simple exception handler logging exception context to flare.

v3.2 2024-05-15 13:01 UTC

This package is auto-updated.

Last update: 2024-12-15 14:24:19 UTC


README

Compatibility

Installation

composer require henrotaym/laravel-flare-exception-handler

Configuration

Environment

LOG_CHANNEL=flare

Usage

Optimal

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());
    }
}

Deprecated

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);