/**
  * @param $object
  *
  * @throws CannotWriteToLogstash
  */
 public function write($object)
 {
     try {
         $this->logger->info('Event recorded', $this->converter->toArray($object));
     } catch (DataToConvertIsNotAnObject $e) {
         $this->handleError(sprintf('Data conversion problem during writing to logstash: %s', $e->getMessage()));
     } catch (\Exception $e) {
         $this->handleError(sprintf('Connection with logstash error: %s', $e->getMessage()));
     }
 }
 /** {@inheritdoc} */
 protected function setUp()
 {
     $this->logger = $this->prophesize(LoggerInterface::class);
     $this->converter = $this->prophesize(ObjectToArrayConverterInterface::class);
     $this->logstash = new Logstash($this->logger->reveal(), $this->converter->reveal());
 }