Download the PHP package wpjscc/laralog without Composer
On this page you can find all versions of the php package wpjscc/laralog. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package laralog
Laralog
功能
- 提供 Laravel Http 中间件,捕捉 Http 请求生命周期内的必要信息
- Http 生命周期信息以
JSON
格式记录到日志文件中 - 提供了日志
JSON
化格式组件,可以无缝使用Filebeat
采集日志到ES
中,避免做格式优化 - 提供了过滤请求中敏感信息的配置,可以过滤到请求参数中的敏感信息,例如,密码等
安装
- 方式一
- 添加
shallowman/laralog
包声明到工程项目的composer.json
文件中 - 使用
composer install
命令安装
- 添加
- 方式一
-
方式二
- 使用如下命令直接安装依赖
- 配置文件发布
- 在项目目录下面运行如下命令,发布
config
资源文件
- 在项目目录下面运行如下命令,发布
配置
配置 Laravel
Http
中间件
- 在
app\Http\Kernel.php
文件中,找到protected $middleware
属性,添加如下声明。
配置写日志组件
-
在
.env
配置中设置默认LOG_CHANNEL
-
在
config/logging.php
中,设置默认日志频道channel
为daily
的日志组件,添加如下配置声明 -
配置过滤敏感信息的键值,如需新增过滤的敏感信息,在
config/laralog.php
中fields
键对应的数组中增加待过滤的请求参数键值(匹配方式使用精准匹配)。 -
配置过滤不捕捉特定 uri 的返回值,在
config/laralog.php
中uri
键对应的数组中增加待过滤的uri
(匹配方式使用模糊匹配)。 -
配置 HTTP 请求
request
和response
包体内容超过设置长度的折叠功能(按照 Multibyte 计算),在config/laralog.php
中添加如下键值对(默认不折叠任何长度的日志)。 -
配置日志存储路径,在
.env
文件中新增配置DAILY_LARALOG_STRORAGE_PATH=/path/to/laralog
- 一个完整的
config/laralog.php
配置示例如下。
Laravel
应用或接口开发时如何记日志
-
日志记录保持不变,如下使用默认
channel
记录日志 - 使用自定义
channel
写日志 (自定义 channel 日志的 driver 需要制定 daily )
All versions of laralog with dependencies
PHP Build Version
Package Version
The package wpjscc/laralog contains the following files
Loading the files please wait ....