FuelPHP Package for Sentry
Sentry is a realtime event logging. This package corresponds to PHP and Javascript., (*1)
Install
Setup to fuel/packages/sentry
If you use git submodule or download zip, you must install vendors, (*2)
$ cd fuel/packages/sentry
$ php composer.phar install
Configuration
In app/config/config.php, (*3)
'always_load' => array('packages' => array(
'sentry',
...
Copy packages/sentry/config/sentry.php to under app/config directory and edit, (*4)
PHP error is automatically send by Error class that has been overridden
JS error is needs the following code in head tag to automatically send
<?php echo Sentry::get_raven_client(); ?>
Example
PHP
Add option and manually logging
// Send exception
$opt = array('tags' => array('MyTag' => 'MyTag Message'));
Sentry::send_exception(new Exception('message'), $opt);
// Send message
$opt = array('tags' => array('MyTag' => 'MyTag Message'));
Sentry::send_message('message', $opt);
Sentry::send_message('%04d-%02d-%02d', $opt, array(2013,4,1));
For more information, see raven-php, (*5)
Javascript
Add option
<?php echo Sentry::get_raven_client(array('logger' => 'MyLogger')); ?>
For more information, see raven-js, (*6)
Manually logging
try {
errorThrowingCode();
} catch(e) {
Raven.captureException(e);
}