mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-05 04:37:38 +02:00
Merge pull request #198 from davidwindell/patch-1
[Raven] Don't log exceptions twice
This commit is contained in:
@@ -18,7 +18,7 @@
|
|||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"mlehner/gelf-php": "1.0.*",
|
"mlehner/gelf-php": "1.0.*",
|
||||||
"raven/raven": "0.3.*",
|
"raven/raven": "0.5.*",
|
||||||
"doctrine/couchdb": "dev-master"
|
"doctrine/couchdb": "dev-master"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
|
@@ -60,10 +60,8 @@ class RavenHandler extends AbstractProcessingHandler
|
|||||||
*/
|
*/
|
||||||
protected function write(array $record)
|
protected function write(array $record)
|
||||||
{
|
{
|
||||||
$level = $this->logLevels[$record['level']];
|
|
||||||
|
|
||||||
$options = array();
|
$options = array();
|
||||||
$options['level'] = $level;
|
$options['level'] = $this->logLevels[$record['level']];
|
||||||
if (!empty($record['context'])) {
|
if (!empty($record['context'])) {
|
||||||
$options['extra']['context'] = $record['context'];
|
$options['extra']['context'] = $record['context'];
|
||||||
}
|
}
|
||||||
@@ -71,15 +69,13 @@ class RavenHandler extends AbstractProcessingHandler
|
|||||||
$options['extra']['extra'] = $record['extra'];
|
$options['extra']['extra'] = $record['extra'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->ravenClient->captureMessage(
|
if (isset($record['context']['exception']) && $record['context']['exception'] instanceof \Exception) {
|
||||||
$record['formatted'],
|
$options['extra']['message'] = $record['formatted'];
|
||||||
array(), // $params - not used
|
$this->ravenClient->captureException($record['context']['exception'], $options);
|
||||||
version_compare(Raven_Client::VERSION, '0.1.0', '>') ? $options : $level, // $level or $options
|
return;
|
||||||
false // $stack
|
|
||||||
);
|
|
||||||
if ($record['level'] >= Logger::ERROR && isset($record['context']['exception'])) {
|
|
||||||
$this->ravenClient->captureException($record['context']['exception']);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->ravenClient->captureMessage($record['formatted'], array(), $options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -15,7 +15,7 @@ use Raven_Client;
|
|||||||
|
|
||||||
class MockRavenClient extends Raven_Client
|
class MockRavenClient extends Raven_Client
|
||||||
{
|
{
|
||||||
public function capture($data, $stack)
|
public function capture($data, $stack, $vars = null)
|
||||||
{
|
{
|
||||||
$this->lastData = $data;
|
$this->lastData = $data;
|
||||||
$this->lastStack = $stack;
|
$this->lastStack = $stack;
|
||||||
|
Reference in New Issue
Block a user