snakano / cake-sentry
Sentry error handler plugin for CakePHP2
Installs: 876
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 16
Open Issues: 0
Type:cakephp-plugin
Requires
- php: >=5.2.8
- composer/installers: *
- raven/raven: ~0.10
This package is auto-updated.
Last update: 2024-10-31 00:39:18 UTC
README
Cake-Sentry is an error handler plugged on Sentry - docs
Installation
Note if you don't install from composer you will have to manually download the raven component and install it before proceeding to step 2.
- Install Sentry Plugin into your CakePHP project with composer :
// composer.json // … "require": { // … "snakano/cake-sentry": "*" }, // …
- Load the cake-sentry Plugin in your bootstrap.php :
CakePlugin::load('Sentry');
- Configure the error handler in your core.php :
App::uses('SentryErrorHandler', 'Sentry.Lib'); Configure::write('Sentry', array( 'production_only' => false, // true is default value -> no error in sentry when debug 'PHP' => array( 'server'=>'http://your-sentry-DSN-for-PHP' ), 'javascript' => array( 'server'=>'http://your-sentry-DSN-for-javascript' ) )); Configure::write('Error', array( 'handler' => 'SentryErrorHandler::handleError', 'level' => E_ALL & ~E_DEPRECATED, 'trace' => true )); Configure::write('Exception', array( 'handler' => 'SentryErrorHandler::handleException', 'renderer'=>'ExceptionRenderer' ));
- Use Sentry as logger :
CakeLog::config('default', array('engine' => 'Sentry.SentryLog'));
- include ravenjs and init script in the default layout :
<?php echo $this->Html->script('jquery'); echo $this->Html->script('ravenjs-min'); ?> <script type="text/javascript"> $(function () { <?php echo $this->element('Sentry.raven-js'); ?> }); </script>