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)
998
998
$ verbosity
999
999
));
1000
1000
}
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 );
1008
1007
}
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
+ ));
1012
1013
}
1013
1014
1014
1015
$ map [constant ($ verbosityConstant )] = $ level ;
Original file line number Diff line number Diff line change @@ -257,7 +257,7 @@ public function testWithConsoleHandler()
257
257
'verbosity_levels ' => [
258
258
'VERBOSITY_NORMAL ' => 'NOTICE ' ,
259
259
'verbosity_verbose ' => 'info ' ,
260
- 'VERBOSITY_very_VERBOSE ' => 150
260
+ 'VERBOSITY_very_VERBOSE ' => ' 200 '
261
261
]
262
262
]
263
263
]
@@ -270,7 +270,7 @@ public function testWithConsoleHandler()
270
270
$ this ->assertSame ([
271
271
OutputInterface::VERBOSITY_NORMAL => Logger::NOTICE ,
272
272
OutputInterface::VERBOSITY_VERBOSE => Logger::INFO ,
273
- OutputInterface::VERBOSITY_VERY_VERBOSE => 150 ,
273
+ OutputInterface::VERBOSITY_VERY_VERBOSE => 200 ,
274
274
OutputInterface::VERBOSITY_QUIET => Logger::ERROR ,
275
275
OutputInterface::VERBOSITY_DEBUG => Logger::DEBUG
276
276
], $ config ['handlers ' ]['console ' ]['verbosity_levels ' ]);
You can’t perform that action at this time.
0 commit comments