/**
  * {@inheritdoc}
  */
 public function report()
 {
     $this->logger->error($this->getMessage());
     if (!$this->config->reportingEnabled()) {
         //No need to record anything
         return;
     }
     $teaser = $this->getMessage();
     $hash = $this->hash($teaser);
     $exception = $this->getException();
     $filename = $this->config->snapshotFilename($exception, time());
     $snapshot = $this->snapshotService->createFromException($exception, $filename, $teaser, $hash);
     $snapshotSource = $this->snapshotService->getSource();
     $snapshotSource->save($snapshot);
     $aggregation = $this->aggregationService->findOrCreateByHash($hash, $teaser);
     $suppress = $snapshotSource->findStored($aggregation)->count() ? $aggregation->isSuppressionEnabled() : false;
     $this->aggregationService->addSnapshot($aggregation, $snapshot, $suppress);
     $this->aggregationService->getSource()->save($aggregation);
     $snapshotSource->save($snapshot);
     if ($suppress) {
         //No need to create file
         return;
     }
     $this->saveSnapshot();
 }
Example #2
0
 /**
  * Save snapshot information on hard-drive.
  */
 protected function saveSnapshot()
 {
     $filename = $this->config->snapshotFilename($this->getException(), time());
     $this->files->write($filename, $this->render(), FilesInterface::RUNTIME, true);
     $snapshots = $this->files->getFiles($this->config->reportingDirectory());
     if (count($snapshots) > $this->config->maxSnapshots()) {
         $this->performRotation($snapshots);
     }
 }