/**
  * {@inheritdoc}
  */
 public function format(array $record)
 {
     $record = parent::format($record);
     $message = new Gelf_Message();
     $message->setTimestamp($record['datetime'])->setShortMessage((string) $record['message'])->setFacility($record['channel'])->setHost($this->systemName)->setLine(isset($record['extra']['line']) ? $record['extra']['line'] : null)->setFile(isset($record['extra']['file']) ? $record['extra']['file'] : null)->setLevel($this->logLevels[$record['level']]);
     // Do not duplicate these values in the additional fields
     unset($record['extra']['line']);
     unset($record['extra']['file']);
     if (isset($record['extra']['memory_usage'])) {
         $record['extra']['mem_usage'] = $record['extra']['memory_usage'];
         unset($record['extra']['memory_usage']);
     }
     if (isset($record['extra']['memory_peak_usage'])) {
         $record['extra']['mem_peak_usage'] = $record['extra']['memory_peak_usage'];
         unset($record['extra']['memory_peak_usage']);
     }
     foreach ($record['extra'] as $key => $val) {
         $message->setAdditional($this->extraPrefix . $key, is_scalar($val) ? $val : $this->toJson($val));
     }
     foreach ($record['context'] as $key => $val) {
         $message->setAdditional($this->contextPrefix . $key, is_scalar($val) ? $val : $this->toJson($val));
     }
     if (null === $message->getFile() && isset($record['context']['exception'])) {
         if (preg_match("/^(.+):([0-9]+)\$/", $record['context']['exception']['file'], $matches)) {
             $message->setFile($matches[1]);
             $message->setLine($matches[2]);
         }
     }
     return $message;
 }
 /**
  * {@inheritdoc}
  */
 public function format(array $record)
 {
     $vars = parent::format($record);
     $output = $this->format;
     foreach ($vars['extra'] as $var => $val) {
         if (false !== strpos($output, '%extra.' . $var . '%')) {
             $output = str_replace('%extra.' . $var . '%', $this->convertToString($val), $output);
             unset($vars['extra'][$var]);
         }
     }
     foreach ($vars as $var => $val) {
         if (false !== strpos($output, '%' . $var . '%')) {
             $output = str_replace('%' . $var . '%', $this->convertToString($val), $output);
         }
     }
     return $output;
 }
 /**
  * @param string $dateFormat The format of the timestamp: one supported by DateTime::format
  */
 public function __construct($dateFormat = null)
 {
     parent::__construct($dateFormat);
 }