承接 swisnl/guzzle-sentry-breadcrumbs-middleware 相关项目开发

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

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

swisnl/guzzle-sentry-breadcrumbs-middleware

最新稳定版本:1.1.0

Composer 安装命令:

composer require swisnl/guzzle-sentry-breadcrumbs-middleware

包简介

Guzzle middleware that logs Sentry breadcrumbs

README 文档

README

Latest Version on Packagist Software License Buy us a tree Build Status Total Downloads Made by SWIS

This is a middleware for Guzzle 7 that leaves Sentry breadcrumbs for all requests.

⚠️ Please make sure you don't log sensitive information to Sentry and properly configure this middleware to redact secrets. ⚠️

Install

Via Composer

composer require swisnl/guzzle-sentry-breadcrumbs-middleware

Usage

use GuzzleHttp\Client as Guzzle;
use GuzzleHttp\HandlerStack;
use Swis\Guzzle\Sentry\BreadcrumbMiddleware;

$stack = HandlerStack::create();
$stack->push(new BreadcrumbMiddleware());
$client = new Guzzle(['handler' => $stack]);

Now when you send a request, a Sentry breadcrumb is logged with the following metadata:

  • method
  • uri
  • status code
  • response body (summary), in case of client or server exceptions (status code >= 400)
  • duration

Config

You can configure the middleware using the constructor arguments:

$category

The category of the breadcrumb.

$message

The message of the breadcrumb.

$redactedStrings

A list of secret strings, such as API keys, that should be filtered out of the metadata.

$truncateBodyAt

The length of the response body summary, which is added to the breadcrumb in case of client or server exceptions. Use null to disable logging response/request body.

By default, it does not log the request body and only logs the response body in case of client or server exceptions (status code >= 400). If you'd like to change this behaviour, you can provide your own GuzzleHttp\BodySummarizerInterface implementation. You can use the default GuzzleHttp\BodySummarizer for example, to log all request and response bodies. Please be aware not to log sensitive information!

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

composer test

Contributing

Please see CONTRIBUTING and CODE_OF_CONDUCT for details.

Security

If you discover any security related issues, please email security@swis.nl instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.

SWIS ❤️ Open Source

SWIS is a web agency from Leiden, the Netherlands. We love working with open source software.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-09-04