yueguang/yueguang-log-drive

There is no license information available for the latest version (dev-main) of this package.

dev-main 2021-12-06 07:39 UTC

This package is auto-updated.

Last update: 2025-07-06 16:21:38 UTC


README

Laravel 自带的日志驱动,只能支持按照日期才分日志。线上翻了一遍,也没发现有更加好的驱动。所以自己实现了一个

日志驱动效果

  1. 支持按照类+日期分做日志分割
  2. 日志详情增加了【file】 显示日志埋点详细位置 【pid】进程号,【traceId】 全局唯一索引,【path】 路由信息

日志驱动效果 图:

埋点:

image

日志展示:

image

日志内容:

image

按照教程

1.安装这个包的时候你的 composer.json 在require可以加这样一行: "yueguang/yueguang-log-drive": "dev-main"
2.下面安装这个自定义包吧: composer update yueguang/yueguang-log-drive
3.执行 composer dump-autoload

使用

在config\logging.php 上新增驱动设置

'custom' => [ 'driver' => 'custom', 'via' => MonologCustomizeFormatter::class, 'path' => storage_path('logs/laravel.log'), 'days' => 30, ],

大功告成!

注意:目前日志驱动只支持Laravel 框架

开源不容易,各位大佬如果觉得好用,点个赞或者打赏一下,支持一下,谢谢大家

a0c1a444651d292cb6862c58de04bdc