Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check is enabled in send massage #24

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/Component.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ class Component extends \yii\base\Component
* @var \Raven_Client|array Raven client or configuration array used to instantiate one
*/
public $client = [];


/**
* @throws InvalidConfigException
*/
public function init()
{
if (!$this->enabled) {
Expand Down Expand Up @@ -97,6 +100,9 @@ private function setEnvironmentOptions()
$this->jsOptions['environment'] = $this->environment;
}

/**
* @throws InvalidConfigException
*/
private function setRavenClient()
{
if (is_array($this->client)) {
Expand Down Expand Up @@ -137,16 +143,28 @@ private function registerAssets()

public function captureMessage($message, $params, $levelOrOptions = [], $stack = false, $vars = null)
{
if (!$this->enabled) {
Yii::trace(Json::encode([$message, $params, $levelOrOptions]), __CLASS__);
Copy link
Collaborator

@nkovacs nkovacs Mar 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yii::trace is deprecated, please use Yii::debug.

Copy link
Author

@wirwolf wirwolf Mar 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All those who use Yii2.0.13 will not be able to use this extension. I propose to correct this problem, and only then do support 2.0.14

return null;
}
return $this->client->captureMessage($message, $params, $levelOrOptions, $stack, $vars);
}

public function captureException($exception, $culpritOrOptions = null, $logger = null, $vars = null)
{
if (!$this->enabled) {
Yii::trace(Json::encode($exception), __CLASS__);
return null;
}
return $this->client->captureException($exception, $culpritOrOptions, $logger, $vars);
}

public function capture($data, $stack = null, $vars = null)
{
if (!$this->enabled) {
Yii::trace(Json::encode($data), __CLASS__);
return null;
}
return $this->client->capture($data, $stack, $vars);
}

Expand Down