DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:sentry

This is an old revision of the document!


sentry Plugin

Compatible with DokuWiki

Greebo

plugin Log errors to Sentry

Last updated on
2018-06-02
Provides
Helper, Action
Repository
Source

This extension has not been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues.

Tagged with logging

A CosmoCode Plugin

This plugin will log errors and exceptions in DokuWiki's PHP backend and the JavaScript frontend to a Sentry instance. You can either use sentry.io or a self hosted instance.

Installation

Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.

Privacy Info: when you install this plugin in a live wiki, you probably need to inform your users that their personal information (username, email, IP-Address, browser info) is logged to Sentry in case of an unforeseen error. Sentry also offers some detailed setting to configure how long personal data is retained.

Changes

Configuration

Use the extension manager and configure the DSN to you sentry project. You can find it under ProjectSettingsClient Keys.

It should look like this: https://<public>:<secret>@<sentryinstance>/<projectid>.

You can configure which kind of errors should be logged via the errors configuration setting. It defaults to what is set for PHP's error_reporting and accepts the same integer. You can use this calculator to figure out the value you want.

The env variable allows you to easily differentiate between multiple wikis being logged into the same Sentry. This is useful when you have a local development and a live wiki for example.

Usage

Once installed and configured, it will log all unhandled errors to Sentry automatically.

You can also use it in your code for specialized logging.

PHP

To log an error use the helper plugin:

try {
    // some code
} catch(\Exception $e) {
    $sentry = plugin_load('helper', 'sentry');
    if($sentry) $sentry->logException($e);
    msg(hsc($e->getMessage()), -1);
}

The helper plugin exposes some more public methods in case you need more control.

JavaScript

To log an error, call the SentryPlugin.logSentryException() method.

try {
    // some code
} catch(error) {
    window.SentryPlugin && SentryPlugin.logSentryException(error, {});
    console.log(error)
}
plugin/sentry.1528103446.txt.gz · Last modified: 2018-06-04 11:10 by andi

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki