daisanmu/laravel-http-logger
Composer 安装命令:
composer require daisanmu/laravel-http-logger
包简介
A Laravel 5 package to log HTTP requests
README 文档
README
功能描述: 日志中间件,可通过route指定中间件来记录http请求的 header ,body,ip,response信息。并且当response错误时可发生邮件到指定邮箱(这需要配置好laravel自带的Mail)。 这些参数都是可配置的。配置文件如下。
记录的log是在storage/log下,命名规则是每天一个request.log文件。
Installation
You can install the package via composer:
composer require daisanmu/laravel-http-logger
Optionally you can publish the configfile with:
php artisan vendor:publish --provider="Daisanmu\HttpLogger\HttpLoggerServiceProvider" --tag="config"
This is the contents of the published config file:
return [ /* * The log profile which determines whether a request should be logged. * It should implement `LogProfile`. */ 'log_profile' => \Daisanmu\HttpLogger\LogNonGetRequests::class, /* * The log writer used to write the request to a log. * It should implement `LogWriter`. */ 'log_writer' => \Daisanmu\HttpLogger\DefaultLogWriter::class, /* * Filter out body fields which will never be logged. */ 'except' => [ 'password', 'password_confirmation', ], /* * Filter out header fields which will never be logged. */ 'except_header' => [ 'postman-token', 'accept', 'accept-language', 'accept-encoding', 'cache-control', 'content-type', 'content-length', 'connection', 'host', 'user-agent', 'origin' ], /** *指定错误发送邮件 */ 'send_mail_status' => [ '500' ], /** *指定到指定邮箱,需要配置laravel的Mail */ 'send_to' => [ '10503331@qq.com' ] ];
Usage
This packages provides a middleware which can be added as a global middleware or as a single route.
// in `app/Http/Kernel.php` protected $middleware = [ // ... \Spatie\HttpLogger\Middlewares\HttpLogger::class ];
// in a routes file Route::post('/submit-form', function () { // })->middleware(\Spatie\HttpLogger\Middlewares\HttpLogger::class);
在spatie/laravel-http-logger 基础上增加记录header IP 和response信息,当response为指定错误码时可发送邮件
fork 自 https://github.com/spatie/laravel-http-logger
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.
daisanmu/laravel-http-logger 适用场景与选型建议
daisanmu/laravel-http-logger 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 12 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel-http-logger」 「daisanmu」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 daisanmu/laravel-http-logger 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 daisanmu/laravel-http-logger 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 daisanmu/laravel-http-logger 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Laravel package to log HTTP requests
Mamitech Laravel HTTP Logger
A logger middleware for HTTP requests and responses
A Laravel package to log HTTP requests
A Laravel 5 package to log HTTP requests
A Laravel 5 package to log HTTP requests
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-12-11