pveltrop/larahandler

Laravel Logger for Exceptions/Requests

v1.2 2020-01-27 19:01 UTC

This package is auto-updated.

Last update: 2021-04-11 12:32:30 UTC


README

Log user requests and exceptions and store these in the database. Also provides a dashboard with a datatable fetching these logs.

Getting Started

Make sure your Laravel project supports:

dd()
File::makeDirectory
File::copyDirectory
File::copy
$this->loadMigrationsFrom
$this->loadViewsFrom
$this->loadRoutesFrom

Prerequisites

All you need is a running Laravel project.

Installing

cd to the root of your project, and install the package:

composer require pveltrop/larahandler

When the package is installed, you need to make a table to store the logs, so run:

php artisan migrate

Then go to your app/Http/Kernel.php and add the LaraRequests class to $middleware:

\App\Http\Middleware\LaraRequests::class,

To log Exceptions, go to your app\Exceptions\Handler.php and add the storeHandler function to $report;

storeHandler($exception,null);

If you want to view the logs on the dashboard and limit this to one specific IP, add another entry to your .env file, called LARAHANDLER_IP. You don't have to specify your local IP, just LAN or WAN. Specify the whitelisted IP here:

LARAHANDLER_IP=yourip

Add this same variable to config/app.php:

'LARAHANDLER_IP' => env('LARAHANDLER_IP', null),

Updating

Simply change the version you want to update to in your root composer.json:

"pveltrop/larahandler": "^(version)",

Then run:

composer update pveltrop/larahandler