1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-07-30 09:50:26 +02:00

Merge pull request #430 from moderndeveloperllc/master

NewRelicHandler: Account for arrays sent in context and extra parameters
This commit is contained in:
Jordi Boggiano
2014-10-04 12:53:35 +01:00
2 changed files with 56 additions and 6 deletions

View File

@@ -47,6 +47,20 @@ class NewRelicHandlerTest extends TestCase
$this->assertEquals(array('context_a' => 'b'), self::$customParameters);
}
public function testThehandlerCanAddExplodedContextParamsToTheNewRelicTrace()
{
$handler = new StubNewRelicHandler(Logger::ERROR, true, self::$appname, true);
$handler->handle($this->getRecord(
Logger::ERROR,
'log message',
array('a' => array('key1' => 'value1', 'key2' => 'value2'))
));
$this->assertEquals(
array('context_a_key1' => 'value1', 'context_a_key2' => 'value2'),
self::$customParameters
);
}
public function testThehandlerCanAddExtraParamsToTheNewRelicTrace()
{
$record = $this->getRecord(Logger::ERROR, 'log message');
@@ -58,6 +72,20 @@ class NewRelicHandlerTest extends TestCase
$this->assertEquals(array('extra_c' => 'd'), self::$customParameters);
}
public function testThehandlerCanAddExplodedExtraParamsToTheNewRelicTrace()
{
$record = $this->getRecord(Logger::ERROR, 'log message');
$record['extra'] = array('c' => array('key1' => 'value1', 'key2' => 'value2'));
$handler = new StubNewRelicHandler(Logger::ERROR, true, self::$appname, true);
$handler->handle($record);
$this->assertEquals(
array('extra_c_key1' => 'value1', 'extra_c_key2' => 'value2'),
self::$customParameters
);
}
public function testThehandlerCanAddExtraContextAndParamsToTheNewRelicTrace()
{
$record = $this->getRecord(Logger::ERROR, 'log message', array('a' => 'b'));