smbear / record-api-logger
Record Laravel Api Logger
v1.0.3
2021-03-18 10:10 UTC
Requires
- php: ^7.4 | ^8.0
- jenssegers/mongodb: ^3.8
This package is auto-updated.
Last update: 2024-10-18 18:08:50 UTC
README
Documentations
- 采用Job记录api接口请求期下,query 和 response
- 默认采用mongodb记录日志,可更换成mysql
- 本扩展满足psr2,psr4规范
- 由于扩展了mongodb 需要配置,点击跳转
Requirements
- PHP ^7.4 | ^8.0
- Laravel 8.x
- jenssegers/mongodb ^3.8
安装
composer require smbear/record-api-logger
发布配置
php artisan vendor:publish --provider="Smbear\RecordApiLogger\AppServiceProvider"
数据库迁移
php artisan migrate --force
分配中间件
'api' => [ \Smbear\RecordApiLogger\Http\Middleware\RecordApi::class, ]
配置门面
'aliases' => [ 'RecordApiLogger' => Smbear\RecordApiLogger\Facades\RecordApiLoggerFacades::class, ]
使用说明
记录操作,采用队列的形式进行,故系统应该采用supervisor来守护队列
php artisan queue:word redis --queue=record-api-logger
日志记录过程中,会导致数据量过大,影响系统性能。通过任务调度的方式,来删除历史数据
php artisan clear:api-logger