File tree Expand file tree Collapse file tree 2 files changed +13
-12
lines changed
Tests/DependencyInjection Expand file tree Collapse file tree 2 files changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -998,17 +998,18 @@ private function addVerbosityLevelSection(ArrayNodeDefinition $handerNode)
998998 $ verbosity
999999 ));
10001000 }
1001- if (!is_numeric ($ level )) {
1002- $ levelConstant = 'Monolog\Logger:: ' .$ level ;
1003- if (!defined ($ levelConstant )) {
1004- throw new InvalidConfigurationException (sprintf (
1005- 'The configured minimum log level "%s" for verbosity "%s" is invalid as it is not defined in Monolog\Logger. ' ,
1006- $ level , $ verbosity
1007- ));
1001+
1002+ try {
1003+ if (Logger::API === 3 ) {
1004+ $ level = Logger::toMonologLevel ($ level )->value ;
1005+ } else {
1006+ $ level = Logger::toMonologLevel (is_numeric ($ level ) ? (int ) $ level : $ level );
10081007 }
1009- $ level = constant ($ levelConstant );
1010- } else {
1011- $ level = (int ) $ level ;
1008+ } catch (\Psr \Log \InvalidArgumentException $ e ) {
1009+ throw new InvalidConfigurationException (sprintf (
1010+ 'The configured minimum log level "%s" for verbosity "%s" is invalid as it is not defined in Monolog\Logger. ' ,
1011+ $ level , $ verbosity
1012+ ));
10121013 }
10131014
10141015 $ map [constant ($ verbosityConstant )] = $ level ;
Original file line number Diff line number Diff line change @@ -257,7 +257,7 @@ public function testWithConsoleHandler()
257257 'verbosity_levels ' => [
258258 'VERBOSITY_NORMAL ' => 'NOTICE ' ,
259259 'verbosity_verbose ' => 'info ' ,
260- 'VERBOSITY_very_VERBOSE ' => 150
260+ 'VERBOSITY_very_VERBOSE ' => ' 200 '
261261 ]
262262 ]
263263 ]
@@ -270,7 +270,7 @@ public function testWithConsoleHandler()
270270 $ this ->assertSame ([
271271 OutputInterface::VERBOSITY_NORMAL => Logger::NOTICE ,
272272 OutputInterface::VERBOSITY_VERBOSE => Logger::INFO ,
273- OutputInterface::VERBOSITY_VERY_VERBOSE => 150 ,
273+ OutputInterface::VERBOSITY_VERY_VERBOSE => 200 ,
274274 OutputInterface::VERBOSITY_QUIET => Logger::ERROR ,
275275 OutputInterface::VERBOSITY_DEBUG => Logger::DEBUG
276276 ], $ config ['handlers ' ]['console ' ]['verbosity_levels ' ]);
You can’t perform that action at this time.
0 commit comments