X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=vendor%2Fsymfony%2Fconsole%2FLogger%2FConsoleLogger.php;h=208575cebf767fc15893f2b741f0291c1dc58dd9;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=987e96a6587e5aecaa2fcddccd2533fae843b9cd;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/vendor/symfony/console/Logger/ConsoleLogger.php b/vendor/symfony/console/Logger/ConsoleLogger.php index 987e96a65..208575ceb 100644 --- a/vendor/symfony/console/Logger/ConsoleLogger.php +++ b/vendor/symfony/console/Logger/ConsoleLogger.php @@ -59,6 +59,7 @@ class ConsoleLogger extends AbstractLogger LogLevel::INFO => self::INFO, LogLevel::DEBUG => self::INFO, ); + private $errored = false; /** * @param OutputInterface $output @@ -81,18 +82,31 @@ class ConsoleLogger extends AbstractLogger throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level)); } + $output = $this->output; + // Write to the error output if necessary and available - if ($this->formatLevelMap[$level] === self::ERROR && $this->output instanceof ConsoleOutputInterface) { - $output = $this->output->getErrorOutput(); - } else { - $output = $this->output; + if ($this->formatLevelMap[$level] === self::ERROR) { + if ($this->output instanceof ConsoleOutputInterface) { + $output = $output->getErrorOutput(); + } + $this->errored = true; } + // the if condition check isn't necessary -- it's the same one that $output will do internally anyway. + // We only do it for efficiency here as the message formatting is relatively expensive. if ($output->getVerbosity() >= $this->verbosityLevelMap[$level]) { - $output->writeln(sprintf('<%1$s>[%2$s] %3$s', $this->formatLevelMap[$level], $level, $this->interpolate($message, $context))); + $output->writeln(sprintf('<%1$s>[%2$s] %3$s', $this->formatLevelMap[$level], $level, $this->interpolate($message, $context)), $this->verbosityLevelMap[$level]); } } + /** + * Returns true when any messages have been logged at error levels. + */ + public function hasErrored() + { + return $this->errored; + } + /** * Interpolates context values into the message placeholders. *