Skip to content

Commit

Permalink
pre-defining output level buffers
Browse files Browse the repository at this point in the history
  • Loading branch information
dcarbone committed Feb 9, 2017
1 parent 81b46da commit f603dcd
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/DefaultLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ class DefaultLogger extends AbstractLogger
LogLevel::EMERGENCY => 7,
];

/** @var array */
protected $slugLevelBuffers = [
LogLevel::DEBUG => ' ',
LogLevel::INFO => ' ',
LogLevel::NOTICE => ' ',
LogLevel::WARNING => ' ',
LogLevel::ERROR => ' ',
LogLevel::CRITICAL => ' ',
LogLevel::ALERT => ' ',
LogLevel::EMERGENCY => ' ',
];

/**
* DefaultLogger constructor.
*
Expand Down Expand Up @@ -114,7 +126,7 @@ public function log($level, $message, array $context = array())

if ($this->levelMap[$this->level] <= $this->levelMap[$level])
{
$slug = sprintf('[%s]%s', strtolower($level), str_repeat(' ', 15 - strlen($level)));
$slug = sprintf('[%s]%s', strtolower($level), $this->slugLevelBuffers[$level]);
if ("\n" !== substr($message, -1))
$message .= "\n";

Expand Down

0 comments on commit f603dcd

Please sign in to comment.