Skip to content

somosdigital/CakePHP2-Sentry

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CakePHP-Sentry

A CakePHP plugin to send errors/exceptions/logs to Sentry (getsentry.com) https://www.getsentry.com

Installation

  1. Clone the files either into app/Plugin/Sentryor private/plugins (remember to also get the PHP Sentry submodule - gitsubmodule init then git submodule update)
  2. Load the plugin in app/Config/bootstrap.php by calling CakePlugin::load('Sentry');
  3. Setup the plugin as the Error/Exception handler in app/Config/core.php
	App::uses('SentryErrorHandler', 'Sentry.Lib');

  Configure::write('Error', array(
    'handler' => 'SentryErrorHandler::handleError',
    'level' => E_ALL & ~E_DEPRECATED,
    'trace' => true
  ));

  Configure::write('Exception', array(
    'handler' => 'SentryErrorHandler::handleException',
    'renderer' => 'ExceptionRenderer',
    'log' => true
  ));
  1. Place your settings in app/Config/core.php
    Configure::write('Sentry', array(
        'DSN' => array(
            // Your private Sentry DSN
            'PHP' => 'http://[email protected]/1'
        ),
        // Configuration for the Sentry user interface - will display a CakePHP logged in user
        'user' => array(
            // Change the model used for the CakePHP user
            'model' => 'CustomUser',
            // Map the fields sent by Sentry to custom fields on the user model
            'fieldMapping' => array(
                'username' => 'custom_username',
                'email' => 'custom_email'
            )
        ),
        'ignoredExceptions' => array('NotFoundException'),
        // Treat any Errors captured in Sentry as warnings
        'treatErrorAsWarning' => true
    ));

About

A CakePHP plugin to send errors/exceptions/logs to Sentry (getsentry.com) https://www.getsentry.com

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%