1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-05 12:47:39 +02:00

RavenHandler handles custom checksums

This commit is contained in:
Tomasz Wójcik
2015-08-15 17:58:48 +02:00
parent 5779c3740e
commit 4551b8c63b
2 changed files with 20 additions and 0 deletions

View File

@@ -145,6 +145,14 @@ class RavenHandler extends AbstractProcessingHandler
} else {
$options['logger'] = $record['channel'];
}
if (!empty($record['extra']['checksum'])) {
$options['checksum'] = $record['extra']['checksum'];
unset($record['extra']['checksum']);
}
if (!empty($record['context']['checksum'])) {
$options['checksum'] = $record['context']['checksum'];
unset($record['context']['checksum']);
}
if (!empty($record['context'])) {
$options['extra']['context'] = $record['context'];
if (!empty($record['context']['user'])) {

View File

@@ -85,6 +85,18 @@ class RavenHandlerTest extends TestCase
$this->assertEquals($tags, $ravenClient->lastData['tags']);
}
public function testChecksum()
{
$ravenClient = $this->getRavenClient();
$handler = $this->getHandler($ravenClient);
$checksum = '098f6bcd4621d373cade4e832627b4f6';
$record = $this->getRecord(Logger::INFO, 'test', array('checksum' => $checksum));
$handler->handle($record);
$this->assertEquals($checksum, $ravenClient->lastData['checksum']);
}
public function testUserContext()
{
$ravenClient = $this->getRavenClient();