Skip to content

Commit

Permalink
PW-7129: Remove full request/response logging (#1712)
Browse files Browse the repository at this point in the history
* PW-7129: Remove full request/response logging

Add new log processors to help with troubleshooting.

* PW-7129: Use context placeholders
  • Loading branch information
michaelpaul committed Sep 15, 2022
1 parent 784ae80 commit a5f3ee2
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 0 additions & 2 deletions Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -1496,8 +1496,6 @@ public function initializeAdyenClient($storeId = null, $apiKey = null, $motoMerc
$client->setEnvironment(\Adyen\Environment::LIVE, $this->getLiveEndpointPrefix($storeId));
}

$client->setLogger($this->adyenLogger);

return $client;
}

Expand Down
2 changes: 1 addition & 1 deletion Helper/Webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public function processNotification(Notification $notification): bool
$currentState = $this->getCurrentState($this->order->getState());
if (!$currentState) {
$this->logger->addAdyenNotification(
sprintf("ERROR: Unhandled order state '%s'.", $this->order->getState()),
"ERROR: Unhandled order state '{orderState}'",
$this->logger->getOrderContext($this->order)
);
return false;
Expand Down
2 changes: 1 addition & 1 deletion Helper/Webhook/CaptureWebhookHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function handleWebhook(MagentoOrder $order, Notification $notification, s

$magentoInvoice = $this->magentoInvoiceFactory->create()->load($adyenInvoice->getInvoiceId(), MagentoInvoice::ENTITY_ID);
$this->adyenLogger->addAdyenNotification(
sprintf('Notification %s updated invoice %s.', $notification->getEntityId(), $magentoInvoice->getEntityid()),
sprintf('Notification %s updated invoice {invoiceId}', $notification->getEntityId()),
$this->adyenLogger->getInvoiceContext($magentoInvoice)
);

Expand Down
4 changes: 2 additions & 2 deletions Observer/InvoiceObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function execute(Observer $observer)


$this->logger->addAdyenDebug(
sprintf('Event sales_order_invoice_save_after for invoice %s will be handled', $invoice->getEntityId()),
'Event sales_order_invoice_save_after for invoice {invoiceId} will be handled',
array_merge($this->logger->getInvoiceContext($invoice), $this->logger->getOrderContext($order))
);

Expand Down Expand Up @@ -134,7 +134,7 @@ public function execute(Observer $observer)
$order->setStatus($status);

$this->logger->addAdyenDebug(
sprintf('Event sales_order_invoice_save_after for invoice %s was handled', $invoice->getEntityId()),
'Event sales_order_invoice_save_after for invoice {invoiceId} was handled',
array_merge($this->logger->getInvoiceContext($invoice), $this->logger->getOrderContext($order))
);
}
Expand Down
4 changes: 4 additions & 0 deletions etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,10 @@
<item name="adyenError" xsi:type="object">Adyen\Payment\Logger\Handler\AdyenError</item>
<item name="adyenWarning" xsi:type="object">Adyen\Payment\Logger\Handler\AdyenWarning</item>
</argument>
<argument name="processors" xsi:type="array">
<item name="uid" xsi:type="object">Monolog\Processor\UidProcessor</item>
<item name="psr3" xsi:type="object">Monolog\Processor\PsrLogMessageProcessor</item>
</argument>
</arguments>
</type>
<type name="Adyen\Payment\Model\Config\Reader">
Expand Down

0 comments on commit a5f3ee2

Please sign in to comment.