/** * {@inheritdoc} */ public function handle($message, callable $next) { try { $this->logstash->write($message); } catch (CannotWriteToLogstash $e) { $this->logger->error($e->getMessage()); } $next($message); }
/** * @test * @expectedException \Clearcode\SimpleBusElkBundle\Logstash\CannotWriteToLogstash */ public function it_fails_when_data_conversion_failed() { $object = new \stdClass(); $this->converter->toArray($object)->willThrow(DataToConvertIsNotAnObject::class); $this->logstash->write($object); }
/** {@inheritdoc} */ protected function setUp() { $this->logger = $this->prophesize(LoggerInterface::class); $this->logstash = $this->prophesize(Logstash::class); $this->middleware = new LogEventMiddleware($this->logstash->reveal(), $this->logger->reveal()); }