unisharp / laravel-loggable
它可以根据arca原则生成实体
dev-master
2017-03-17 09:52 UTC
Requires
- php: >=5.4.0
- illuminate/support: >=5.0.0
Requires (Dev)
- phpunit/phpunit: ~4.8
This package is auto-updated.
Last update: 2024-09-15 14:28:04 UTC
README
此包在将异常写入laravel.log
之前格式化异常。
安装
-
通过composer安装
composer require unisharp/laravel-filemanager
-
设置
config/app.php
'providers' => [ ... Unisharp\Loggable\LoggableServiceProvider::class, ],
'aliases' => [ ... 'Loggable' => Unisharp\Loggable\Facades\Loggable::class, ],
-
替换
App\Exceptions\Handler.php
中的默认异常报告器public function report(Exception $e) { // parent::report($e); return \Loggable::report($e); }
日志显示类型
-
简单日志
404 not found. | (GET) http://your-domain/js/jquery.min.map | User ID : null | IP: 127.0.0.1
Model not found. | (GET) http://your-domain/article/999 | User ID : 6 | IP: 127.0.0.1
-
带有跟踪和输入的详细日志
2016-11-17 19:03:46] local.DEBUG: { "user_id": 4, "ip": "::1", "action_trace": { "0": "Visited : OrderController | Action : create", "1": "Visited : CartController | Action : count | Type : Ajax", "2": "Visited : CartController | Action : show", "3": "Visited : CartController | Action : count | Type : Ajax", "4": "Visited : OrderController | Action : create", "5": "Visited : CartController | Action : count | Type : Ajax", "6": "Visited : OrderController | Action : store", "FormRequest failed": { "receiver_name": "", "receiver_phone": "", "note": "", "_token": "Mvi43arsvzrqH5RuzQVPl0GdU2xVwE7FO79Lxw1A" } } }
处理的异常
- 详细日志
- 表单请求错误
- 简单日志
- TokenMismatchException
- ModelNotFoundException
- NotFoundHttpException
- HttpException
- 当发生其他异常时,将同时写入简单日志和原始堆栈跟踪。