Skip to content

Commit c86ebe4

Browse files
committed
Fallback to just using the action level for BC with older monolog releases
1 parent 196f2bd commit c86ebe4

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function getConfigTreeBuilder()
6363
->scalarNode('facility')->defaultValue('user')->end() // syslog
6464
->scalarNode('max_files')->defaultValue(0)->end() // rotating
6565
->scalarNode('action_level')->defaultValue('WARNING')->end() // fingers_crossed
66-
->scalarNode('activation_strategy')->end() // fingers_crossed
66+
->scalarNode('activation_strategy')->defaultNull()->end() // fingers_crossed
6767
->booleanNode('stop_buffering')->defaultTrue()->end()// fingers_crossed
6868
->scalarNode('buffer_size')->defaultValue(0)->end() // fingers_crossed and buffer
6969
->scalarNode('handler')->end() // fingers_crossed and buffer

DependencyInjection/MonologExtension.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,18 +151,15 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler
151151
$nestedHandlerId = $this->getHandlerId($handler['handler']);
152152
$this->nestedHandlers[] = $nestedHandlerId;
153153

154-
if (!isset($handler['activation_strategy'])) {
155-
$container
156-
->register($handlerId.'.activation_strategy', '%monolog.handler.fingers_crossed.error_level_activation_strategy.class%')
157-
->addArgument($handler['activation_level'])
158-
;
159-
160-
$handler['activation_strategy'] = $handlerId.'.activation_strategy';
154+
if (isset($handler['activation_strategy'])) {
155+
$activation = new Reference($handler['activation_strategy']);
156+
} else {
157+
$activation = $handler['action_level'];
161158
}
162159

163160
$definition->setArguments(array(
164161
new Reference($nestedHandlerId),
165-
new Reference($handler['activation_strategy']),
162+
$activation,
166163
$handler['buffer_size'],
167164
$handler['bubble'],
168165
$handler['stop_buffering'],

0 commit comments

Comments
 (0)