[MonologBridge] Allow to change level format

This is needed to allow to remove fixed padding of level name
This commit is contained in:
Gabriel Ostrolucký 2018-02-19 01:51:42 +01:00 committed by GitHub
parent b0facfec01
commit fbd257c25d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,6 +60,7 @@ class ConsoleFormatter implements FormatterInterface
'date_format' => self::SIMPLE_DATE,
'colors' => true,
'multiline' => false,
'level_name_format' => '%-9s',
), $options);
if (class_exists(VarCloner::class)) {
@ -119,7 +120,7 @@ class ConsoleFormatter implements FormatterInterface
$formatted = strtr($this->options['format'], array(
'%datetime%' => $record['datetime']->format($this->options['date_format']),
'%start_tag%' => sprintf('<%s>', $levelColor),
'%level_name%' => sprintf('%-9s', $record['level_name']),
'%level_name%' => sprintf($this->options['level_name_format'], $record['level_name']),
'%end_tag%' => '</>',
'%channel%' => $record['channel'],
'%message%' => $this->replacePlaceHolder($record)['message'],