Skip to content

Commit 201fec3

Browse files
committed
Merge pull request #145 from mablae/mablae-patch
Added missing ignore_error option to Configuration
2 parents b930783 + fb358f4 commit 201fec3

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

DependencyInjection/Configuration.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ public function getConfigTreeBuilder()
419419
->end() // elasticsearch
420420
->scalarNode('index')->defaultValue('monolog')->end() // elasticsearch
421421
->scalarNode('document_type')->defaultValue('logs')->end() // elasticsearch
422+
->scalarNode('ignore_error')->defaultValue(false)->end() // elasticsearch
422423
->arrayNode('config')
423424
->canBeUnset()
424425
->prototype('scalar')->end()

DependencyInjection/MonologExtension.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler
254254
array(
255255
'index' => $handler['index'],
256256
'type' => $handler['document_type'],
257+
'ignore_error' => $handler['ignore_error']
257258
),
258259
$handler['level'],
259260
$handler['bubble'],

Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,31 @@ public function testWithSwiftMailerHandler()
217217
$this->assertEquals('mailer', $config['handlers']['swift']['mailer']);
218218
}
219219

220+
public function testWithElasticsearchHandler() {
221+
$configs = array(
222+
array(
223+
'handlers' => array(
224+
'elasticsearch' => array(
225+
'type' => 'elasticsearch',
226+
'elasticsearch' => array(
227+
'id' => 'elastica.client'
228+
),
229+
'index' => 'my-index',
230+
'document_type' => 'my-record',
231+
'ignore_error' => true
232+
)
233+
)
234+
)
235+
);
236+
237+
$config = $this->process($configs);
238+
239+
$this->assertEquals(true, $config['handlers']['elasticsearch']['ignore_error']);
240+
$this->assertEquals('my-record', $config['handlers']['elasticsearch']['document_type']);
241+
$this->assertEquals('my-index', $config['handlers']['elasticsearch']['index']);
242+
243+
}
244+
220245
public function testWithConsoleHandler()
221246
{
222247
$configs = array(

0 commit comments

Comments
 (0)