承接 gentenox/sentry-monolog-handler 相关项目开发

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

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

gentenox/sentry-monolog-handler

Composer 安装命令:

composer require gentenox/sentry-monolog-handler

包简介

Custom Sentry handler for Monolog for sending log context data to sentry eventsand it's focussed on ease-of-use and elegant syntax.

README 文档

README

Custom Sentry handler for Monolog for sending log context data to sentry events with additional event information and it's focussed on ease-of-use and elegant syntax

Installation

Install via composer

You can install the package using the Composer package manager. You can install it by running this command in your project root:

composer require gentenox/sentry-monolog-handler

Add config for monolog handler to config/packages/monolog.yaml

monolog:
  handlers:
    sentry:
      type: service
      id: monolog_context_handler

Add new service to services.yaml

monolog_context_handler:
  class: SentryMonologHandler\MonologContextHandler
  arguments:
    $hub: '@Sentry\State\HubInterface'
    $level: !php/const Monolog\Logger::ERROR

Basic Usage

In examples below used monolog logger that implements Psr\Log\LoggerInterface

Log error with context data

In this example sentry error handler receive logger context data end send it to Sentry as sentry event context data

$logger->error('Cannot find existing order for user', [
    'user_id' => $user->getId()
]);

Log with specific sentry properties

In this example sentry error handler receive logger context data and handle specific properties such as tags and fingerprint These specific properties will not be added to logs and used only for providing additional event information to Sentry

Field Type Description
MonologFields::Tags array Contains Sentry tags. Tags are key/value string pairs and used for filtering events
MonologFields::Fingerprint array Contains Sentry fingerprint. Events with the same fingerprint are grouped together into an issue
$logger->error('Invalid postback received', [
    MonologFields::Tags->value => ['scope' => 'postback_validation']
    MonologFields::Fingerprint->value => ['postback_validation_fingerprint']
]);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-09-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固