mongoCollection = $mongo->selectCollection($database, $collection); $this->saveOptions = $saveOptions; } /** * This writer does not support formatting. * * @param string|FormatterInterface $formatter * @return WriterInterface */ public function setFormatter($formatter) { return $this; } /** * Write a message to the log. * * @param array $event Event data * @return void * @throws Exception\RuntimeException */ protected function doWrite(array $event) { if (null === $this->mongoCollection) { throw new Exception\RuntimeException('MongoCollection must be defined'); } if (isset($event['timestamp']) && $event['timestamp'] instanceof DateTime) { $event['timestamp'] = new MongoDate($event['timestamp']->getTimestamp()); } $this->mongoCollection->save($event, $this->saveOptions); } }