Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function log($level, $message, array $context = array())
 {
     if (!isset($this->verbosityLevelMap[$level])) {
         throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
     }
     // 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 ($output->getVerbosity() >= $this->verbosityLevelMap[$level]) {
         $output->writeln(sprintf('<%1$s>[%2$s] %3$s</%1$s>', $this->formatLevelMap[$level], $level, $this->interpolate($message, $context)));
     }
 }