Skip to content

Commit

Permalink
Merge pull request #1 from ujovlado/docs
Browse files Browse the repository at this point in the history
Improved documentation
  • Loading branch information
ujovlado committed Jan 5, 2016
2 parents 594f7b9 + 5d3c34f commit 8b6a642
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 4 deletions.
21 changes: 17 additions & 4 deletions 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

Expand Down Expand Up @@ -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

Expand Down
16 changes: 16 additions & 0 deletions src/Rekurzia/log/SentryTarget.php
Expand Up @@ -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();
Expand All @@ -25,6 +37,7 @@ public function init()
}

/**
* Gets Raven Client instance.
* @return \Raven_Client
*/
public function getClient()
Expand All @@ -36,6 +49,9 @@ public function getClient()
return $this->_client;
}

/**
* Sends log message to Sentry instance.
*/
public function export()
{
foreach ($this->messages as $message) {
Expand Down

0 comments on commit 8b6a642

Please sign in to comment.