Skip to content

Commit

Permalink
4.1.0: Improve debug logs (MAG-668)
Browse files Browse the repository at this point in the history
  • Loading branch information
ebanolopes committed Apr 16, 2021
1 parent 5901ab2 commit ee1f158
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions Observer/Debug/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,21 @@ public function execute(Observer $observer)
$state = $order->getState();
$currentState = $order->getOrigData('state');

if ($state <> $currentState) {
$incrementId = $order->getIncrementId();
$incrementId = $order->getIncrementId();

$this->logger->debug("Order {$incrementId} state change from {$currentState} to {$state}");
$this->logger->debug("Request URL: {$this->url->getCurrentUrl()}");
$this->logger->debug("Order {$incrementId} state change from {$currentState} to {$state}");
$this->logger->debug("Request URL: {$this->url->getCurrentUrl()}");

list($debugBacktraceLog, $nonMagentoModules) = $this->getDebugBacktrace();
list($debugBacktraceLog, $nonMagentoModules) = $this->getDebugBacktrace();

if (empty($nonMagentoModules) == false) {
$nonMagentoModulesList = implode(', ', array_keys($nonMagentoModules));
$this->logger->debug("WARNING: non Magento modules found on backtrace: " .
$nonMagentoModulesList);
}

$debugBacktraceLog = implode("\n", $debugBacktraceLog);
$this->logger->debug("Backtrace: \n{$debugBacktraceLog}\n\n");
if (empty($nonMagentoModules) == false) {
$nonMagentoModulesList = implode(', ', array_keys($nonMagentoModules));
$this->logger->debug("WARNING: non Magento modules found on backtrace: " .
$nonMagentoModulesList);
}

$debugBacktraceLog = implode("\n", $debugBacktraceLog);
$this->logger->debug("Backtrace: \n{$debugBacktraceLog}\n\n");
}
} catch (\Exception $e) {
$this->logger->debug("State debug failed: " . $e->getMessage());
Expand Down

0 comments on commit ee1f158

Please sign in to comment.