@@ -50,6 +50,7 @@ class ConsoleHandler extends AbstractProcessingHandler implements EventSubscribe
5050 OutputInterface::VERBOSITY_VERY_VERBOSE => Logger::INFO ,
5151 OutputInterface::VERBOSITY_DEBUG => Logger::DEBUG ,
5252 ];
53+ private $ consoleFormaterOptions ;
5354
5455 /**
5556 * @param OutputInterface|null $output The console output to use (the handler remains disabled when passing null
@@ -58,14 +59,16 @@ class ConsoleHandler extends AbstractProcessingHandler implements EventSubscribe
5859 * @param array $verbosityLevelMap Array that maps the OutputInterface verbosity to a minimum logging
5960 * level (leave empty to use the default mapping)
6061 */
61- public function __construct (OutputInterface $ output = null , bool $ bubble = true , array $ verbosityLevelMap = [])
62+ public function __construct (OutputInterface $ output = null , bool $ bubble = true , array $ verbosityLevelMap = [], array $ consoleFormaterOptions = [] )
6263 {
6364 parent ::__construct (Logger::DEBUG , $ bubble );
6465 $ this ->output = $ output ;
6566
6667 if ($ verbosityLevelMap ) {
6768 $ this ->verbosityLevelMap = $ verbosityLevelMap ;
6869 }
70+
71+ $ this ->consoleFormaterOptions = $ consoleFormaterOptions ;
6972 }
7073
7174 /**
@@ -155,13 +158,13 @@ protected function getDefaultFormatter()
155158 return new LineFormatter ();
156159 }
157160 if (!$ this ->output ) {
158- return new ConsoleFormatter ();
161+ return new ConsoleFormatter ($ this -> consoleFormaterOptions );
159162 }
160163
161- return new ConsoleFormatter ([
164+ return new ConsoleFormatter (array_replace ( [
162165 'colors ' => $ this ->output ->isDecorated (),
163166 'multiline ' => OutputInterface::VERBOSITY_DEBUG <= $ this ->output ->getVerbosity (),
164- ]);
167+ ], $ this -> consoleFormaterOptions ) );
165168 }
166169
167170 /**
0 commit comments