8000 feature #297 Expose configuration for the ConsoleHandler (lyrixx) · symfony/monolog-bundle@005aefb · GitHub
[go: up one dir, main page]

Skip to content

Commit 005aefb

Browse files
committed
feature #297 Expose configuration for the ConsoleHandler (lyrixx)
This PR was merged into the 3.x-dev branch. Discussion ---------- Expose configuration for the ConsoleHandler Like that we will be able to use this configuration (for example): ```yaml console: type: console process_psr_3_messages: false channels: ["!event", "!doctrine", "!console"] console_formater_options: format: "%%datetime%% %%start_tag%%%%level_name%%%%end_tag%% <comment>[%%channel%%]</> %%message%%%%context%%\n" multiline: false ``` see also symfony/symfony#30345 Commits ------- cc9abf6 Expose configuration for the ConsoleHandler
2 parents 523768f + cc9abf6 commit 005aefb

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

DependencyInjection/Configuration.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
* - [verbosity_levels]: level => verbosity configuration
3737
* - [level]: level name or int value, defaults to DEBUG
3838
* - [bubble]: bool, defaults to true
39+
* - [console_formater_options]: array
3940
*
4041
* - firephp:
4142
* - [level]: level name or int value, defaults to DEBUG
@@ -571,6 +572,16 @@ public function getConfigTreeBuilder()
571572
->then(function ($v) { return array_filter(array_map('trim', $v)); })
572573
->end()
573574
->prototype('scalar')->end()
575+
->end()
576+
// console
577+
->variableNode('console_formater_options')
578+
->defaultValue([])
579+
->validate()
580+
->ifTrue(function ($v) {
581+
return !is_array($v);
582+
})
583+
->thenInvalid('console_formater_options must an array.')
584+
->end()
574585
->end()
575586
->arrayNode('verbosity_levels') // console
576587
->beforeNormalization()

DependencyInjection/MonologExtension.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler
176176
null,
177177
$handler['bubble'],
178178
isset($handler['verbosity_levels']) ? $handler['verbosity_levels'] : array(),
179+
$handler['console_formater_options']
179180
));
180181
$definition->addTag('kernel.event_subscriber');
181182
break;

0 commit comments

Comments
 (0)
0