mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-04 20:27:31 +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": {
|
||||
"mlehner/gelf-php": "1.0.*",
|
||||
"raven/raven": "0.3.*",
|
||||
"raven/raven": "0.5.*",
|
||||
"doctrine/couchdb": "dev-master"
|
||||
},
|
||||
"suggest": {
|
||||
|
@@ -60,10 +60,8 @@ class RavenHandler extends AbstractProcessingHandler
|
||||
*/
|
||||
protected function write(array $record)
|
||||
{
|
||||
$level = $this->logLevels[$record['level']];
|
||||
|
||||
$options = array();
|
||||
$options['level'] = $level;
|
||||
$options['level'] = $this->logLevels[$record['level']];
|
||||
if (!empty($record['context'])) {
|
||||
$options['extra']['context'] = $record['context'];
|
||||
}
|
||||
@@ -71,15 +69,13 @@ class RavenHandler extends AbstractProcessingHandler
|
||||
$options['extra']['extra'] = $record['extra'];
|
||||
}
|
||||
|
||||
$this->ravenClient->captureMessage(
|
||||
$record['formatted'],
|
||||
array(), // $params - not used
|
||||
version_compare(Raven_Client::VERSION, '0.1.0', '>') ? $options : $level, // $level or $options
|
||||
false // $stack
|
||||
);
|
||||
if ($record['level'] >= Logger::ERROR && isset($record['context']['exception'])) {
|
||||
$this->ravenClient->captureException($record['context']['exception']);
|
||||
if (isset($record['context']['exception']) && $record['context']['exception'] instanceof \Exception) {
|
||||
$options['extra']['message'] = $record['formatted'];
|
||||
$this->ravenClient->captureException($record['context']['exception'], $options);
|
||||
return;
|
||||
}
|
||||
|
||||
$this->ravenClient->captureMessage($record['formatted'], array(), $options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -15,7 +15,7 @@ use Raven_Client;
|
||||
|
||||
class MockRavenClient extends Raven_Client
|
||||
{
|
||||
public function capture($data, $stack)
|
||||
public function capture($data, $stack, $vars = null)
|
||||
{
|
||||
$this->lastData = $data;
|
||||
$this->lastStack = $stack;
|
||||
|
Reference in New Issue
Block a user