sinarajabpour1998/log-manager
Laravel log manager with UI components and migrations to store custom activity logs and system error logs in database tables. Define log types in config, use LogFacade to generate logs, and hook into Exception Handler to capture errors.
This package provides log manager for laravel apps.
Using Composer :
composer require sinarajabpour1998/log-manager
packagist : log-manager
php artisan vendor:publish --tag=log-manager
** Please note if you already published the vendor, for updates you can run the following command :
php artisan vendor:publish --tag=log-manager --force
php artisan migrate
<x-log-menu></x-log-menu>
or shorten tag :
<x-log-menu />
Types structure: "type" => "type_name"
[
"log_types" => [
"login" => "ورود به سایت",
"registration" => "ثبت نام در سایت"
]
];
use Sinarajabpour1998\LogManager\Facades\LogFacade;
LogFacade::generateLog("login");
Done ! now all the logs will be saved in the logs table
Edit the following file :
app\Exceptions\Handler.php
Your register method in Exception handler must be like this :
use Sinarajabpour1998\LogManager\Facades\LogFacade;
/**
* Register the exception handling callbacks for the application.
*
* @return void
*/
public function register()
{
$this->reportable(function (Throwable $e) {
// Added for log-manager
if ($this->shouldReport($e)){
LogFacade::generateErrorLog($e);
}
});
}
Done ! now all the system error logs will be saved in the error_logs table
You can set custom permissions for each section of this package. make sure that you already specified permissions in a seeder.
Also you need log_types before get started with custom logs.
How can I help you explore Laravel packages today?