Exemple #1
0
 /**
  * @inheritdoc
  */
 public function format(Record $record)
 {
     $replacements = [];
     if (false !== strpos($this->messageFormat, '%datetime%')) {
         $replacements['%datetime%'] = $this->convertToString($record->getCreatedAt());
     }
     if (false !== strpos($this->messageFormat, '%channel%')) {
         $replacements['%channel%'] = $record->getChannel();
     }
     if (false !== strpos($this->messageFormat, '%level_name%')) {
         $replacements['%level_name%'] = $record->getLevel()->getName();
     }
     if (false !== strpos($this->messageFormat, '%message%')) {
         $replacements['%message%'] = $record->getMessage();
     }
     if (false !== strpos($this->messageFormat, '%context%')) {
         $replacements['%context%'] = $this->convertToString($record->getContext(), true);
     }
     if (false !== strpos($this->messageFormat, '%extras%')) {
         $replacements['%extras%'] = $this->convertToString($record->getExtras(), true);
     }
     return strtr($this->messageFormat, $replacements);
 }
Exemple #2
0
 /**
  * @inheritdoc
  */
 protected function write(Record $record)
 {
     $this->logger->log($record->getLevel()->getName(), $record->getMessage(), $record->getContext());
 }
 /**
  * @inheritdoc
  */
 public function process(Record $record)
 {
     $record->setMessage(strtr($record->getMessage(), $this->getReplacements($record)));
 }