承接 guave/sentry-bundle 相关项目开发

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

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

guave/sentry-bundle

最新稳定版本:1.0.2

Composer 安装命令:

composer require guave/sentry-bundle

包简介

Sentry integration for Contao 5.0+

README 文档

README

Deprecated

This Repo is no longer maintained. Please use oneup/contao-sentry-bundle

Sentry Bundle

This contao module allow you to integrate Sentry via Twig into your templates with sentry/sentry-symfony bundle

Requirements

  • Contao 5.0+
  • PHP 8.1+

Install

$ composer require guave/sentry-bundle

Usage

First, configure the sentry/sentry-symfony bundle: Documentation

Recommended configuration

sentry:
    dsn: "https://xyz@sentry.io/xy"
    register_error_listener: false

Sentry\Monolog\Handler:
    arguments:
        $hub: '@Sentry\State\HubInterface'
        $level: !php/const Monolog\Logger::ERROR # Can be one of https://github.com/Seldaek/monolog/blob/master/doc/01-usage.md#log-levels, but System::log() only uses INFO or ERROR
        $bubble: false

monolog:
    handlers:
        sentry:
            type: service
            id: Sentry\Monolog\Handler
            priority: 100 # Higher priority than ContaoTableHandler which will stop handling afterwards (bubbling is set to true)
            bubble: false # Use bubble: true if you don't want the logs to show up in the system log (bubbling means, no monolog handlers will run afterwards)

User feedback

On the other hand you might want to implement the User feedback feature of sentry. The user feedback is primarily useful to let the users know that you've gotten notified about the issue and to let users give the opportunity to add some comments.

In order to integrate this feature, you have to alter the error page template. Place a copy of vendor/contao/core-bundle/src/Resources/views/Error/layout.html.twig in the directory app/Resources/ContaoCoreBundle/views/Error/.

Modify the copied template and place the following snippet just before the closing </body> tag:

{% set sentry_id = ''|sentry_last_event_id %}
{% if sentry_id %}
    <script src="https://browser.sentry-cdn.com/5.7.1/bundle.min.js"
            integrity="sha384-KMv6bBTABABhv0NI+rVWly6PIRvdippFEgjpKyxUcpEmDWZTkDOiueL5xW+cztZZ"
            crossorigin="anonymous"></script>
    <script>
        Sentry.init({dsn: '{{ ''|sentry_dsn }}'});
        Sentry.showReportDialog({eventId: '{{ sentry_id }}'})

        // You can also bind the "show" method to an event, e.g. to open the modal on button click
        {#document.querySelector('.btn-report').addEventListener('click', function (e) {#}
        {#    e.preventDefault();#}
        {#    Sentry.showReportDialog({eventId: '{{ sentry_id }}'})#}
        {#});#}
    </script>
{% endif %}

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: ISC
  • 更新时间: 2023-06-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固