This is a plugin for Kirby that logs erros to Sentry.
git submodule add https://github.com/kreativ-anders/kirby-sentry.git
git submodule update --init --recursive
Add your Sentry DSN to the site/config/config.php:
/*
---------------------------------------
Sentry Configuration
---------------------------------------
https://<key>:<secret>@app.getsentry.com/<project>
*/
c::set('sentry.PUBLIC_KEY', '<key>');
c::set('sentry.SECRET_KEY', '<secret>');
c::set('sentry.HOST', 'app.getsentry.com');
c::set('sentry.PATH', '/');
c::set('sentry.PROJECT_ID', '<project>');
c::set('sentry.dsn', 'https://' . c::get('sentry.PUBLIC_KEY') . ':' . c::get('sentry.SECRET_KEY') . '@' . c::get('sentry.HOST') . c::get('sentry.PATH') . c::get('sentry.PROJECT_ID')); // Do Not Change
c::set('sentry.dsn_public', 'https://' . c::get('sentry.PUBLIC_KEY') . '@' . c::get('sentry.HOST') . c::get('sentry.PATH') . c::get('sentry.PROJECT_ID')); // Do Not Change
c::set('sentry.disabled', false);
// Get Sentry Raven client
$client = kirby_sentry();
// Start error reporting
$client->captureMessage('blah blah!');
Add this to your site/snippets/footer.php, after any other libraries are included, but before your own scripts
<?php if (
($sentryDsn_public = c::get('sentry.dsn_public'))
&& !c::get('sentry.disabled', false)
): ?>
<?= js('https://cdn.ravenjs.com/3.0.4/raven.min.js') ?>
<script>Raven.config('<?= $sentryDsn_public ?>').install()</script>
<?php endif ?>
You can use the following Options - make use of kirbys Multi-environment setup.
Type: boolean
Default value: false
disable the sentry plugin
Type: String
Default value: <key>
Type: String
Default value: <secret>
Type: String
Default value: app.getsentry.com
Type: String
Default value: /
Type: String
Default value: <project>
Type: String
Do not change this value, it will be generated automatically. Your Sentry DSN, keep this secret.
Type: String
Do not change this value, it will be generated automatically. Your public Sentry DSN, you can use this for Javascript e.g.