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

WebProcessor: option to add only requested extra fields, instead of always adding all available

This commit is contained in:
Dawid Nowak
2014-07-01 20:41:03 +02:00
parent 9aba3242f6
commit 6a4b73468e
2 changed files with 26 additions and 2 deletions

View File

@@ -73,6 +73,21 @@ class WebProcessorTest extends TestCase
$this->assertFalse(isset($record['extra']['unique_id']));
}
public function testProcessorAddsOnlyRequestedExtraFields()
{
$server = array(
'REQUEST_URI' => 'A',
'REMOTE_ADDR' => 'B',
'REQUEST_METHOD' => 'C',
'SERVER_NAME' => 'F',
);
$processor = new WebProcessor($server, array('url', 'http_method'));
$record = $processor($this->getRecord());
$this->assertSame(array('url' => 'A', 'http_method' => 'C'), $record['extra']);
}
/**
* @expectedException UnexpectedValueException
*/