custom/plugins/RpayPayments/src/Components/Logging/Subscriber/RequestBuilderFailedSubscriber.php line 32

Open in your IDE?
  1. <?php
  2. /*
  3.  * Copyright (c) Ratepay GmbH
  4.  *
  5.  * For the full copyright and license information, please view the LICENSE
  6.  * file that was distributed with this source code.
  7.  */
  8. namespace Ratepay\RpayPayments\Components\Logging\Subscriber;
  9. use Monolog\Logger;
  10. use Ratepay\RpayPayments\Components\RatepayApi\Event\RequestBuilderFailedEvent;
  11. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  12. class RequestBuilderFailedSubscriber implements EventSubscriberInterface
  13. {
  14.     protected Logger $logger;
  15.     public function __construct(Logger $fileLogger)
  16.     {
  17.         $this->logger $fileLogger;
  18.     }
  19.     public static function getSubscribedEvents(): array
  20.     {
  21.         return [
  22.             RequestBuilderFailedEvent::class => 'onRequestBuilderFailed',
  23.         ];
  24.     }
  25.     public function onRequestBuilderFailed(RequestBuilderFailedEvent $event): void
  26.     {
  27.         //$requestData = $event->getRequestData();
  28.         $exception $event->getException();
  29.         $this->logger->error('RequestBuilder failed', [
  30.             'message' => $exception->getMessage(),
  31.             'trace' => $exception->getTraceAsString(),
  32.         ]);
  33.     }
  34. }