承接 bmwx591/request-logger 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

bmwx591/request-logger

最新稳定版本:v0.0.2

Composer 安装命令:

composer require bmwx591/request-logger

包简介

Library for logging application requests

README 文档

README

MIT License

 The simple template for create request logging system.

  All that you need is to use some logger that implement Psr\Log\LoggerInterface and request mapper that implements Bmwx591\RequestLogger\Mapper\RequestMapperInterface for mapping log message and context. If you want to use some special rules to check if you need to log one request or another you can add rules resolver implementation of Bmwx591\RequestLogger\RulesResolver\RulesResolverInterface. If you won`t add rules resolver than all requests will be logged.

  Logger works with wrapped requests and responses so you can write you own wrappers by implement Bmwx591\RequestLogger\Logger\WrappedRequest and Bmwx591\RequestLogger\Logger\WrappedResponse interfaces to add ability to work with you type of requests and responses if they don`t implement PSR-7 Psr\Http\Message\RequestInterface and Psr\Http\Message\ResponseInterface.

Usage/Examples

use Bmwx591\RequestLogger\Logger\RequestLogger;

$requestLogger = new RequestLogger(
    new SomeLogger(), // some implementation of Psr\Log\LoggerInterface
    $requestMapper, // implementation of RequestMapperInterface for map message and content for request
    $rulesResolver // implementation of RulesResolverInterface or null
);

$requestLogger
    ->incomingRequest(<wrapped request>)
    ->outgoingResponse(<wrapped response>)
    ->addExternal(<ExternalRequest instance>)
    ->pushLogs();

Authors

Running Tests

To run tests, run the following command

vendor/bin/phpunit

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-02-19