From 5d3c34f80fca1ce679b47c29ba0f3a8dabc04781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Kri=C5=A1ka?= Date: Tue, 5 Jan 2016 23:05:01 +0100 Subject: [PATCH] Improved documentation --- README.md | 21 +++++++++++++++++---- src/Rekurzia/log/SentryTarget.php | 16 ++++++++++++++++ 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d4e9a7e..67fd754 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Yii2 Sentry log target -Yii2 log target sends log messages to your Sentry instance. +Yii2 log target which sends log messages to your Sentry instance. ## Installation @@ -28,10 +28,23 @@ $config['components']['log']['targets'] = [ ]; ``` -where: +## Configuration -- `includeContextMessage` is optional, default `false` -- `options` is optional, default `[]` +### `dsn` + +Raven-compatible DSN. + +### `options` + +These options will be passed to `Raven_Client` constructor + +### `includeContextMessage` + +This option allows you to hide `info` level context message. + +By default Yii generates also context message for you. It means that there will +be two messages logged to your Sentry instance on error. First with `error` +level, second with `info` level. ## License diff --git a/src/Rekurzia/log/SentryTarget.php b/src/Rekurzia/log/SentryTarget.php index b99ed3b..68ef148 100644 --- a/src/Rekurzia/log/SentryTarget.php +++ b/src/Rekurzia/log/SentryTarget.php @@ -8,14 +8,26 @@ class SentryTarget extends Target { + /** + * @var string Raven-compatible DSN + */ public $dsn; + /** + * @var array options to be passed to Raven Client + */ public $options = []; + /** + * @var boolean whether to include context message + */ public $includeContextMessage = false; private $_client; + /** + * @inheritdoc + */ public function init() { parent::init(); @@ -25,6 +37,7 @@ public function init() } /** + * Gets Raven Client instance. * @return \Raven_Client */ public function getClient() @@ -36,6 +49,9 @@ public function getClient() return $this->_client; } + /** + * Sends log message to Sentry instance. + */ public function export() { foreach ($this->messages as $message) {