DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:sentry

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
plugin:sentry [2018-06-02 11:39] – created andiplugin:sentry [2020-07-02 23:51] (current) – version upped andi
Line 3: Line 3:
 ---- plugin ---- ---- plugin ----
 description: Log errors to Sentry description: Log errors to Sentry
-author     : Andreas Gohr  +author     : Andreas Gohr, Michael Große 
-email      : andi@splitbrain.org +email      : dokuwiki@cosmocode.de
 type       : action, helper type       : action, helper
-lastupdate : 2018-06-02+lastupdate : 2020-07-02
 compatible : Greebo compatible : Greebo
 depends    :  depends    : 
 conflicts  conflicts 
 similar    :  similar    : 
-tags       : logging+tags       : logging, devel
  
 downloadurl: https://github.com/cosmocode/dokuwiki-plugin-sentry/zipball/master downloadurl: https://github.com/cosmocode/dokuwiki-plugin-sentry/zipball/master
Line 20: Line 20:
 screenshot_img :  screenshot_img : 
 ---- ----
 +
 +[[https://www.cosmocode.de/en/open-source/dokuwiki-plugins/|{{ http://cosmocode.de/static/img/dokuwiki/dwplugins.png?recache|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 [[https://sentry.io|sentry.io]] or a self hosted instance. This plugin will log errors and exceptions in DokuWiki's PHP backend and the JavaScript frontend to a Sentry instance. You can either use [[https://sentry.io|sentry.io]] or a self hosted instance.
Line 25: Line 27:
 ===== Installation ===== ===== Installation =====
  
-Install the plugin using the [[plugin:plugin|Plugin Manager]] and the download URL above, which points to latest version of the plugin. Refer to [[:Plugins]] on how to install plugins manually.+Search and install the plugin using the [[plugin:extension|Extension Manager]]. 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** 
 + 
 +{{rss>https://github.com/cosmocode/dokuwiki-plugin-sentry/commits/master.atom date}}
  
 ===== Configuration ===== ===== Configuration =====
  
-Use the extension manager and configure the DSN to you sentry project. You can find it under project settings -> Client Keys.+Use the extension manager and configure the DSN to you sentry project. You can find it under //Project// -> //Settings// -> //Client Keys//.
  
 It should look like this: ''%%https://<public>:<secret>@<sentryinstance>/<projectid>%%''. 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 [[phpfn>error_reporting]] and accepts the same integer. You can use this [[https://maximivanov.github.io/php-error-reporting-calculator/|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 ===== ===== Usage =====
Line 43: Line 54:
 ==== PHP ==== ==== PHP ====
  
-To log an error use the helper plguin+To log an error use the helper plugin:
  
 <code php> <code php>
Line 52: Line 63:
     if($sentry) $sentry->logException($e);     if($sentry) $sentry->logException($e);
     msg(hsc($e->getMessage()), -1);     msg(hsc($e->getMessage()), -1);
 +}
 +</code>
 +
 +The helper plugin exposes some more public methods in case you need more control.
 +
 +You can also use the following to log an arbitrary message and additional data. (Useful when debugging problems on a live server):
 +
 +<code php>
 +$sentry = plugin_load('helper','sentry');
 +if($sentry) {
 +     $sentry->logMessage('my log message', array( 'something' => $info) );
 } }
 </code> </code>
plugin/sentry.1527932357.txt.gz · Last modified: 2018-06-02 11:39 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