2017 © Pedro Peláez
 

contao-bundle contao-sentry-bundle

This bundle provides an easy integration of sentry.io for Contao 4.4.x and newer.

image

oneup/contao-sentry-bundle

This bundle provides an easy integration of sentry.io for Contao 4.4.x and newer.

  • Monday, July 2, 2018
  • by bytehead
  • Repository
  • 1 Watchers
  • 1 Stars
  • 18 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 1 Versions
  • 1700 % Grown

The README.md

Contao Sentry Bundle

This Contao bundle provides an easy integration of sentry.io for Contao 4.4.x and newer., (*1)

Author Software License Total Downloads, (*2)

--, (*3)

In the first place, this is an "wrapper extension" for the sentry/sentry-symfony bundle. Therefore, you need to configure this bundle as you would configure the sentry/sentry-symfony bundle: Documentation, (*4)

If you also want to report the system log errors to Sentry, this is the recommended configuration:, (*5)

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., (*6)

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/., (*7)

Modify the copied template and place the following snippet just before the closing </body> tag:, (*8)

{% set sentry_id = ''|sentry_last_event_id %}
{% if sentry_id %}
    
    <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 %}

![User Feedback in action][4], (*9)

The Versions

02/07 2018

dev-master

9999999-dev https://github.com/1up-lab/contao-sentry-bundle

This bundle provides an easy integration of sentry.io for Contao 4.4.x and newer.

  Sources   Download

MIT

The Requires

 

The Development Requires

tracking contao raven sentry error