Skip to content

Commit 9e34b50

Browse files
committed
tweaked code
1 parent 61a78a6 commit 9e34b50

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

DependencyInjection/Configuration.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
* - handler: the wrapped handler's name
9090
* - [action_level|activation_strategy]: minimum level or service id to activate the handler, defaults to WARNING
9191
* - [excluded_404s]: if set, the strategy will be changed to one that excludes 404s coming from URLs matching any of those patterns
92-
* - [excluded_http_codes]: if set, the strategy will be changed to one that excludes specific HTTP codes
92+
* - [excluded_http_codes]: if set, the strategy will be changed to one that excludes specific HTTP codes (requires Symfony Monolog bridge 4.1+)
9393
* - [buffer_size]: defaults to 0 (unlimited)
9494
* - [stop_buffering]: bool to disable buffering once the handler has been activated, defaults to true
9595
* - [passthru_level]: level name or int value for messages to always flush, disabled by default
@@ -383,12 +383,10 @@ public function getConfigTreeBuilder()
383383
*/
384384

385385
if (is_array($value)) {
386-
return isset($value['code'])
387-
? $value
388-
: array('code' => key($value), 'url' => current($value));
386+
return isset($value['code']) ? $value : array('code' => key($value), 'urls' => current($value));
389387
}
390388

391-
return array('code' => $value, 'url' => array());
389+
return array('code' => $value, 'urls' => array());
392390
}, $values);
393391
})
394392
->end()

DependencyInjection/MonologExtension.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,9 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler
325325
$container->setDefinition($handlerId.'.not_found_strategy', $activationDef);
326326
$activation = new Reference($handlerId.'.not_found_strategy');
327327
} elseif (!empty($handler['excluded_http_codes'])) {
328+
if (!class_exists('Symfony\Bridge\Monolog\Handler\FingersCrossed\HttpCodeActivationStrategy')) {
329+
throw new LogicException('"excluded_http_codes" cannot be used as your version of Monolog bridge does not support it.');
330+
}
328331
$activationDef = new Definition('Symfony\Bridge\Monolog\Handler\FingersCrossed\HttpCodeActivationStrategy', array(
329332
new Reference('request_stack'),
330333
$handler['excluded_http_codes'],

0 commit comments

Comments
 (0)