/**
  * @covers Monolog\Formatter\JsonFormatter::formatBatch
  * @covers Monolog\Formatter\JsonFormatter::formatBatchNewlines
  */
 public function testFormatBatchNewlines()
 {
     $formatter = new JsonFormatter(JsonFormatter::BATCH_MODE_NEWLINES);
     $records = $expected = array($this->getRecord(Logger::WARNING), $this->getRecord(Logger::DEBUG));
     array_walk($expected, function (&$value, $key) {
         $value = json_encode($value);
     });
     $this->assertEquals(implode("\n", $expected), $formatter->formatBatch($records));
 }
 /**
  * @covers Monolog\Formatter\JsonFormatter::formatBatch
  */
 public function testFormatBatch()
 {
     $formatter = new JsonFormatter();
     $records = array($this->getRecord(Logger::WARNING), $this->getRecord(Logger::DEBUG));
     $this->assertEquals(json_encode($records), $formatter->formatBatch($records));
 }
Esempio n. 3
0
 public function formatBatch(array $records)
 {
     return parent::formatBatch(array_map(function (array $record) {
         return $this->mapRecord($record);
     }, $records));
 }
 public function formatBatch(array $records)
 {
     $records = array_map('el_format_record', $records);
     return parent::formatBatch($records);
 }