engvanntha/request-trace 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

engvanntha/request-trace

最新稳定版本:v1.0.0

Composer 安装命令:

composer require engvanntha/request-trace

包简介

Request-aware class/function/variable logging for Laravel applications.

README 文档

README

Reusable request-aware logging package for Laravel 5.8 through 12.

Installation

composer require engvanntha/request-trace

Features

  • Captures X-Request-Id from incoming HTTP requests (falls back to generated UUID).
  • Auto logs all client requests/responses with Class@method (no per-function calls).
  • Provides RequestTraceTrait for class/function/variable-aware logs.
  • Supports variable selection and sensitive-field masking.
  • Works in controllers, services, middleware, and other classes.

Trait usage

use Engvanntha\RequestTrace\Traits\RequestTraceTrait;

class ClassName
{
    use RequestTraceTrait;

    public function functionName(array $data)
    {
        $user = $this->queryUser($data);

        // Log one variable
        $this->traceLog('user', $user);

        // Log selected variables only
        $this->traceLogVars(compact('data', 'user'), array('user'));

        return $user;
    }
}

Generated message format:

<X-Request-Id>@<CurrentProjectName>@<ClassName>@<functionName>@<variableName>

Middleware

Register middleware:

\Engvanntha\RequestTrace\Middleware\CaptureRequestTrace::class

This middleware should run early in the HTTP stack.

With auto_log_requests=true, each request is logged automatically in format:

<X-Request-Id>@<CurrentProjectName>@<ClassName>@<functionName>@<request|response>

Use RequestTraceTrait only for additional deep logs inside selected services/functions.

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-27

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固