@@ -50,6 +50,7 @@ class ConsoleHandler extends AbstractProcessingHandler implements EventSubscribe
50
50
OutputInterface::VERBOSITY_VERY_VERBOSE => Logger::INFO ,
51
51
OutputInterface::VERBOSITY_DEBUG => Logger::DEBUG ,
52
52
];
53
+ private $ consoleFormaterOptions ;
53
54
54
55
/**
55
56
* @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
58
59
* @param array $verbosityLevelMap Array that maps the OutputInterface verbosity to a minimum logging
59
60
* level (leave empty to use the default mapping)
60
61
*/
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 = [] )
62
63
{
63
64
parent ::__construct (Logger::DEBUG , $ bubble );
64
65
$ this ->output = $ output ;
65
66
66
67
if ($ verbosityLevelMap ) {
67
68
$ this ->verbosityLevelMap = $ verbosityLevelMap ;
68
69
}
70
+
71
+ $ this ->consoleFormaterOptions = $ consoleFormaterOptions ;
69
72
}
70
73
71
74
/**
@@ -155,13 +158,13 @@ protected function getDefaultFormatter()
155
158
return new LineFormatter ();
156
159
}
157
160
if (!$ this ->output ) {
158
- return new ConsoleFormatter ();
161
+ return new ConsoleFormatter ($ this -> consoleFormaterOptions );
159
162
}
160
163
161
- return new ConsoleFormatter ([
164
+ return new ConsoleFormatter (array_replace ( [
162
165
'colors ' => $ this ->output ->isDecorated (),
163
166
'multiline ' => OutputInterface::VERBOSITY_DEBUG <= $ this ->output ->getVerbosity (),
164
- ]);
167
+ ], $ this -> consoleFormaterOptions ) );
165
168
}
166
169
167
170
/**
0 commit comments