sinarajabpour1998/log-manager
Composer 安装命令:
composer require sinarajabpour1998/log-manager
包简介
This package provides log manager in laravel apps.
README 文档
README
This package provides log manager for laravel apps.
Installation
Using Composer :
composer require sinarajabpour1998/log-manager
packagist : log-manager
Usage
- Publish blade files
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
- Run migration command :
php artisan migrate
- Add the following tag in your sidebar layout :
<x-log-menu></x-log-menu>
or shorten tag :
<x-log-menu />
Save custom logs
- First define some log types in log-manager config :
Types structure: "type" => "type_name"
[ "log_types" => [ "login" => "ورود به سایت", "registration" => "ثبت نام در سایت" ] ];
- Add the following code anywhere you want (be careful about namespace)
use Sinarajabpour1998\LogManager\Facades\LogFacade; LogFacade::generateLog("login");
Done ! now all the logs will be saved in the logs table
Save system error logs
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
Config options
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.
统计信息
- 总下载量: 61
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-11-14