mirror of
https://github.com/Seldaek/monolog.git
synced 2025-08-10 15:14:14 +02:00
Account for context and extra params that are sent as arrays (GitProcessor for one). New __construct param is optional and set to false to emulate current feature set.
This commit is contained in:
@@ -48,6 +48,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');
|
||||
@@ -59,6 +73,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'));
|
||||
|
Reference in New Issue
Block a user