diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0c7da5bd..f27610c4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,11 @@
# Changelog
+## Unreleased
+### Add
+- Add campaigns to category view page
+- Improve logging system
+
## [v4.2.1] - 2023.09.25
+### Fix
- Fix problem with ssr/record-list.phtml template
## [v4.2.0] - 2023.09.18
diff --git a/src/Controller/Adminhtml/TestConnection/TestConnection.php b/src/Controller/Adminhtml/TestConnection/TestConnection.php
index 2186ed80..36a38d1b 100644
--- a/src/Controller/Adminhtml/TestConnection/TestConnection.php
+++ b/src/Controller/Adminhtml/TestConnection/TestConnection.php
@@ -10,6 +10,7 @@
use Omikron\FactFinder\Communication\Client\ClientBuilder;
use Omikron\FactFinder\Communication\Credentials;
use Omikron\FactFinder\Communication\Resource\AdapterFactory;
+use Omikron\Factfinder\Logger\FactFinderLogger;
use Omikron\Factfinder\Model\Api\CredentialsFactory;
use Omikron\Factfinder\Model\Config\AuthConfig;
use Psr\Http\Client\ClientExceptionInterface;
@@ -21,19 +22,22 @@ class TestConnection extends Action
private CredentialsFactory $credentialsFactory;
private AuthConfig $authConfig;
private ClientBuilder $clientBuilder;
+ private FactFinderLogger $logger;
public function __construct(
Action\Context $context,
JsonFactory $jsonResultFactory,
CredentialsFactory $credentialsFactory,
AuthConfig $authConfig,
- ClientBuilder $clientBuilder
+ ClientBuilder $clientBuilder,
+ FactFinderLogger $logger
) {
parent::__construct($context);
$this->jsonResultFactory = $jsonResultFactory;
$this->credentialsFactory = $credentialsFactory;
$this->authConfig = $authConfig;
$this->clientBuilder = $clientBuilder;
+ $this->logger = $logger;
}
public function execute()
@@ -54,6 +58,10 @@ public function execute()
$message = new Phrase('Connection successfully established.');
} catch (ClientExceptionInterface $e) {
+ $this->logger->error(new Phrase(
+ 'FACT-Finder response exception: %1, thrown at %2',
+ [$e->getMessage(), $e->getTraceAsString()]
+ ));
$message = $e->getMessage();
}
diff --git a/src/Controller/Adminhtml/TestConnection/TestFtpConnection.php b/src/Controller/Adminhtml/TestConnection/TestFtpConnection.php
index ae6517d6..9011431c 100644
--- a/src/Controller/Adminhtml/TestConnection/TestFtpConnection.php
+++ b/src/Controller/Adminhtml/TestConnection/TestFtpConnection.php
@@ -7,6 +7,7 @@
use Magento\Backend\App\Action;
use Magento\Framework\Controller\Result\JsonFactory;
use Magento\Framework\Phrase;
+use Omikron\Factfinder\Logger\FactFinderLogger;
use Omikron\Factfinder\Model\Config\FtpConfig;
use Omikron\Factfinder\Model\FtpUploader;
@@ -16,17 +17,20 @@ class TestFtpConnection extends Action
private JsonFactory $jsonResultFactory;
private FtpUploader $ftpUploader;
private FtpConfig $ftpConfig;
+ private FactFinderLogger $logger;
public function __construct(
Action\Context $context,
JsonFactory $jsonResultFactory,
FtpUploader $ftpUploader,
- FtpConfig $ftpConfig
+ FtpConfig $ftpConfig,
+ FactFinderLogger $logger
) {
parent::__construct($context);
$this->jsonResultFactory = $jsonResultFactory;
$this->ftpUploader = $ftpUploader;
$this->ftpConfig = $ftpConfig;
+ $this->logger = $logger;
}
public function execute()
@@ -38,6 +42,10 @@ public function execute()
$params = $this->getConfig($this->getRealValuesFromObscured($request->getParams())) + $this->ftpConfig->toArray();
$this->ftpUploader->testConnection($params);
} catch (\Exception $e) {
+ $this->logger->error(new Phrase(
+ 'FACT-Finder FTP exception: %1, thrown at %2',
+ [$e->getMessage(), $e->getTraceAsString()]
+ ));
$message = $e->getMessage();
}
diff --git a/src/Logger/FactFinderLogger.php b/src/Logger/FactFinderLogger.php
new file mode 100644
index 00000000..86082e52
--- /dev/null
+++ b/src/Logger/FactFinderLogger.php
@@ -0,0 +1,9 @@
+createConfiguredMock(JsonFactory::class, ['create' => $this->createMock(JsonResult::class)]),
$credentialsFactory,
$this->createMock(AuthConfig::class),
- $this->builderMock
+ $this->builderMock,
+ $this->createMock(FactFinderLogger::class)
);
}
}
diff --git a/src/Test/Unit/Controller/Adminhtml/TestConnection/TestFtpConnectionTest.php b/src/Test/Unit/Controller/Adminhtml/TestConnection/TestFtpConnectionTest.php
index b7195213..84db86f1 100644
--- a/src/Test/Unit/Controller/Adminhtml/TestConnection/TestFtpConnectionTest.php
+++ b/src/Test/Unit/Controller/Adminhtml/TestConnection/TestFtpConnectionTest.php
@@ -8,6 +8,7 @@
use Magento\Framework\App\RequestInterface;
use Magento\Framework\Controller\Result\Json as JsonResult;
use Magento\Framework\Controller\Result\JsonFactory;
+use Omikron\Factfinder\Logger\FactFinderLogger;
use Omikron\Factfinder\Model\Config\FtpConfig;
use Omikron\Factfinder\Model\FtpUploader;
use PHPUnit\Framework\MockObject\MockObject;
@@ -77,7 +78,8 @@ protected function setUp(): void
$this->createConfiguredMock(Context::class, ['getRequest' => $this->request]),
$this->createConfiguredMock(JsonFactory::class, ['create' => $this->jsonResult]),
$this->ftpUploader,
- $this->createMock(FtpConfig::class)
+ $this->createMock(FtpConfig::class),
+ $this->createMock(FactFinderLogger::class)
);
}
}
diff --git a/src/etc/di.xml b/src/etc/di.xml
index 89d867f6..2d9209f8 100644
--- a/src/etc/di.xml
+++ b/src/etc/di.xml
@@ -232,4 +232,17 @@
+
+
+ Magento\Framework\Filesystem\Driver\File
+
+
+
+
+ FACT-Finder
+
+ - Omikron\Factfinder\Logger\Handler\FactFinderErrorHandler
+
+
+