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.13 and 5.x., (*1)

Author Software License Total Downloads, (*2)

--, (*3)

This is a "wrapper extension" for the sentry/sentry-symfony bundle., (*4)

Setup in the Contao Managed Edition

The basic integration is automatically configured to some sane defaults. To enable the integration, configure the SENTRY_DSN variable in your .env.local file., (*5)

Additionally, you can name the SENTRY_ENV in your .env.local file, which can be useful if you e.g. have a test and prod installation., (*6)

If you need to change any of the defaults, simply configure the sentry/sentry-symfony bundle according to the Documentation., (*7)

Manual configuration

If you do not use the Contao Managed Edition, you need to configure this bundle as you would configure the sentry/sentry-symfony bundle: Documentation, (*8)

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

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 templates/ContaoCoreBundle/views/Error/., (*10)

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

{% 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, (*12)

Error tracking helper

The Oneup\ContaoSentryBundle\ErrorHandlingTrait adds useful Sentry helpers., (*13)

  • ErrorHandlingTrait::sentryOrThrow will either log an error/exception to sentry, or it will throw an exception if Sentry integration is not available (e.g. on localhost or in dev environment). It is mostly useful when running looping cronjobs, like synchronizing Contao with a remote system, so an error on syncing a record will not prevent the sync loop from finishing other records., (*14)

  • ErrorHandlingTraig::sentryCheckIn has been added for the new [Sentry Cron job monitoring][5]. Call sentryCheckIn() without argument to start a check in, and subsequently with a boolean true or false after the job has successfully run or failed., (*15)

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