diff --git a/composer.json b/composer.json
index 7146e0a..a096921 100644
--- a/composer.json
+++ b/composer.json
@@ -6,11 +6,12 @@
"guzzlehttp/guzzle": "^7",
"prewk/xml-string-streamer": "^1.2",
"prewk/xml-string-streamer-guzzle": "^1.2",
- "kevinrob/guzzle-cache-middleware": "^1.4",
+ "kevinrob/guzzle-cache-middleware": "^4",
"ecomdev/magento-psr6-bridge": "^0.2.1",
"symfony/stopwatch": "~4.0",
"bakame/psr7-csv-factory": "^1.0@dev",
- "league/csv": "^9.1"
+ "league/csv": "^9.1",
+ "monolog/monolog": "^2.8"
},
"type": "magento2-module",
"autoload": {
diff --git a/src/Model/ImportProfile.php b/src/Model/ImportProfile.php
index 2146f94..3f77a8a 100644
--- a/src/Model/ImportProfile.php
+++ b/src/Model/ImportProfile.php
@@ -94,19 +94,19 @@ public function run()
]);
$this->consoleOutput->writeln($output);
- $this->log->addInfo($output);
+ $this->log->info($output);
$this->consoleOutput->writeln("$errors");
- $this->log->addError($errors);
+ $this->log->error($errors);
return \Magento\Framework\Console\Cli::RETURN_SUCCESS;
} catch (\Exception $e) {
$this->consoleOutput->writeln($e->getMessage());
- $this->log->addCritical($e->getMessage());
+ $this->log->critical($e->getMessage());
$innerExceptionIterator = $e->getPrevious();
while ($innerExceptionIterator !== null) {
$this->consoleOutput->writeln($innerExceptionIterator->getMessage());
- $this->log->addCritical($innerExceptionIterator->getMessage());
+ $this->log->critical($innerExceptionIterator->getMessage());
$innerExceptionIterator = $innerExceptionIterator->getPrevious();
}
@@ -131,7 +131,7 @@ private function getItemsMeasured()
{
$this->stopwatch->start('profileinstance');
$this->consoleOutput->writeln('Getting item data');
- $this->log->addInfo('Getting item data');
+ $this->log->info('Getting item data');
$items = $this->getItems();
$stopwatchEvent = $this->stopwatch->stop('profileinstance');
@@ -148,7 +148,7 @@ private function getItemsMeasured()
]);
$this->consoleOutput->writeln($output);
- $this->log->addInfo($output);
+ $this->log->info($output);
return $items;
}
diff --git a/src/Plugin/PrintImportLogWhenCliPlugin.php b/src/Plugin/PrintImportLogWhenCliPlugin.php
index 54383a2..de2b024 100644
--- a/src/Plugin/PrintImportLogWhenCliPlugin.php
+++ b/src/Plugin/PrintImportLogWhenCliPlugin.php
@@ -34,6 +34,6 @@ public function beforeAddLogComment(
) {
$debugData = is_array($debugData) ? implode(', ', $debugData) : $debugData;
$this->consoleOutput->writeln("{$debugData}");
- $this->log->addInfo((string)$debugData);
+ $this->log->info((string)$debugData);
}
}
diff --git a/src/RowModifier/AssignAllWebsites.php b/src/RowModifier/AssignAllWebsites.php
index 99108d1..9824bb7 100644
--- a/src/RowModifier/AssignAllWebsites.php
+++ b/src/RowModifier/AssignAllWebsites.php
@@ -44,7 +44,7 @@ public function __construct(
public function process()
{
$this->consoleOutput->writeln("Assigning all products to all websites...");
- $this->log->addInfo('Assigning all products to all websites...');
+ $this->log->info('Assigning all products to all websites...');
$allWebsites = $this->allWebsites();
diff --git a/src/RowModifier/AttributeOptionCreator.php b/src/RowModifier/AttributeOptionCreator.php
index 657ea06..0e74cb3 100644
--- a/src/RowModifier/AttributeOptionCreator.php
+++ b/src/RowModifier/AttributeOptionCreator.php
@@ -86,7 +86,7 @@ public function process()
{
$attributes = implode(', ', $this->attributes);
$this->consoleOutput->writeln("Creating attribute options for: {$attributes}");
- $this->log->addInfo('Creating attribute options for:'. $attributes);
+ $this->log->info('Creating attribute options for:'. $attributes);
foreach ($this->attributes as $attribute) {
$this->createForAttribute($attribute);
@@ -146,7 +146,7 @@ protected function getNonExistingAttributes(string $attribute): array
$this->consoleOutput->writeln(
"AttributeOptionCreator: Invalid value for {$attribute} {$identifier}"
);
- $this->log->addError("AttributeOptionCreator: Invalid value for {$attribute} {$identifier}");
+ $this->log->error("AttributeOptionCreator: Invalid value for {$attribute} {$identifier}");
$item[$attribute] = '';
continue;
diff --git a/src/RowModifier/ConfigurableBuilder.php b/src/RowModifier/ConfigurableBuilder.php
index 08b324c..c0750e0 100644
--- a/src/RowModifier/ConfigurableBuilder.php
+++ b/src/RowModifier/ConfigurableBuilder.php
@@ -94,7 +94,7 @@ public function __construct(
public function process()
{
$this->consoleOutput->writeln("Creating configurable products...");
- $this->log->addInfo('Creating configurable products...');
+ $this->log->info('Creating configurable products...');
$skuCallback = $this->configurableSku;
$attrCallback = $this->attributes;
@@ -146,7 +146,7 @@ public function process()
$count = count($configurables);
$this->consoleOutput->writeln("{$count} potential configurables created");
- $this->log->addInfo("{$count} potential configurables created");
+ $this->log->info("{$count} potential configurables created");
$configurables = $this->splitOnValue($configurables);
if ($this->enableFilterConfigurable) {
@@ -165,7 +165,7 @@ public function process()
$count = count($configurables);
$this->consoleOutput->writeln("Created {$count} configurables");
- $this->log->addInfo("Created {$count} configurables");
+ $this->log->info("Created {$count} configurables");
$this->items = array_replace($this->items, $configurables);
}
@@ -270,7 +270,7 @@ private function splitOnValue($configurables)
$count = count($newConfigurables) - count($configurables);
if ($count > 0) {
$this->consoleOutput->writeln("Created {$count} extra configurables while splitting");
- $this->log->addInfo("Created {$count} extra configurables while splitting");
+ $this->log->info("Created {$count} extra configurables while splitting");
}
return $newConfigurables;
diff --git a/src/RowModifier/ExternalCategoryManagement.php b/src/RowModifier/ExternalCategoryManagement.php
index 75bd81c..6a039a3 100644
--- a/src/RowModifier/ExternalCategoryManagement.php
+++ b/src/RowModifier/ExternalCategoryManagement.php
@@ -70,7 +70,7 @@ public function __construct(
public function process()
{
$this->consoleOutput->writeln("Adding existing product category associations");
- $this->log->addInfo('Adding existing product category associations');
+ $this->log->info('Adding existing product category associations');
$this->initCategoryMapping();
$this->initCategoryProductMapping();
@@ -85,7 +85,7 @@ public function process()
$categories = array_merge($categories, $this->categoryMapping[$category]);
}
}
-
+
if (isset($this->productCategoryMapping[$identifier])) {
$categories = array_merge($categories, $this->productCategoryMapping[$identifier]);
}
diff --git a/src/RowModifier/ItemMapper.php b/src/RowModifier/ItemMapper.php
index 37e7db4..1e054ac 100644
--- a/src/RowModifier/ItemMapper.php
+++ b/src/RowModifier/ItemMapper.php
@@ -66,7 +66,7 @@ public function validateItem(array $item, $sku)
public function process()
{
$this->consoleOutput->writeln("Mapping item information");
- $this->log->addInfo('Mapping item information');
+ $this->log->info('Mapping item information');
foreach ($this->items as $identifier => $item) {
try {
@@ -86,7 +86,7 @@ public function process()
$this->consoleOutput->writeln(
"Value is a object or array for $identifier: {$val}"
);
- $this->log->addInfo("Value is a object or array for $identifier: {$val}");
+ $this->log->info("Value is a object or array for $identifier: {$val}");
return null;
}
@@ -97,14 +97,14 @@ public function process()
$output = sprintf('Error validating, skipping %s: %s', $identifier, implode(',', $itemsValidated));
$this->consoleOutput->writeln(sprintf('%s', $output));
- $this->log->addError($output);
+ $this->log->error($output);
}
} catch (\Exception $e) {
$this->consoleOutput->writeln(
"ItemMapper: {$e->getMessage()} (removing product {$identifier})"
);
- $this->log->addError("ItemMapper: {$e->getMessage()} (removing product {$identifier})");
+ $this->log->error("ItemMapper: {$e->getMessage()} (removing product {$identifier})");
unset($this->items[$identifier]);
}
diff --git a/src/RowModifier/NonUniqueSourceIterator.php b/src/RowModifier/NonUniqueSourceIterator.php
index ecde90e..ca05489 100644
--- a/src/RowModifier/NonUniqueSourceIterator.php
+++ b/src/RowModifier/NonUniqueSourceIterator.php
@@ -77,7 +77,7 @@ public function __construct(
public function process()
{
$this->consoleOutput->writeln("NonUniqueSourceIterator: Adding information from stream");
- $this->log->addInfo('NonUniqueSourceIterator: Adding information from stream');
+ $this->log->info('NonUniqueSourceIterator: Adding information from stream');
$identifier = $this->identifier;
foreach ($this->iterator as $item) {
@@ -89,7 +89,7 @@ public function process()
$this->consoleOutput->writeln(
"NonUniqueSourceIterator: Item not found for {$id}"
);
- $this->log->addInfo("NonUniqueSourceIterator: Item not found for {$id}");
+ $this->log->info("NonUniqueSourceIterator: Item not found for {$id}");
continue;
}
diff --git a/src/RowModifier/ProductDisabler.php b/src/RowModifier/ProductDisabler.php
index 01a08ba..1e20815 100644
--- a/src/RowModifier/ProductDisabler.php
+++ b/src/RowModifier/ProductDisabler.php
@@ -86,7 +86,7 @@ public function process()
$count = count($itemsToDisable);
$this->consoleOutput->writeln("ProductDisabler: Disabling {$count} products");
- $this->log->addInfo("ProductDisabler: Disabling {$count} products");
+ $this->log->info("ProductDisabler: Disabling {$count} products");
$this->items += $itemsToDisable;
}
diff --git a/src/RowModifier/ProductMapper.php b/src/RowModifier/ProductMapper.php
index 15f72ef..a13b666 100644
--- a/src/RowModifier/ProductMapper.php
+++ b/src/RowModifier/ProductMapper.php
@@ -32,7 +32,7 @@ public function validateItem(array $item)
public function process()
{
$this->consoleOutput->writeln("Mapping product information");
- $this->log->addInfo('Mapping product information');
+ $this->log->info('Mapping product information');
foreach ($this->getSourceItems() as $item) {
try {
@@ -53,12 +53,12 @@ public function process()
$output = sprintf('Error validating, skipping %s: %s', $identifier, implode(',', $errors));
$this->consoleOutput->writeln(sprintf('%s', $output));
- $this->log->addInfo($output);
+ $this->log->info($output);
}
} catch (\Exception $e) {
$this->consoleOutput->writeln("{$e->getMessage()}");
- $this->log->addError($e->getMessage());
+ $this->log->error($e->getMessage());
}
}
}
diff --git a/src/RowModifier/ProductUrlKey.php b/src/RowModifier/ProductUrlKey.php
index d3ad9c4..3ae486d 100644
--- a/src/RowModifier/ProductUrlKey.php
+++ b/src/RowModifier/ProductUrlKey.php
@@ -105,14 +105,14 @@ public function __construct(
public function process()
{
$this->consoleOutput->writeln("Checking url_keys and make sure they are unique");
- $this->log->addInfo('Checking url_keys and make sure they are unique');
+ $this->log->info('Checking url_keys and make sure they are unique');
$this->initProductToSku();
foreach ($this->items as $identifier => &$item) {
//check for existence.
if (empty($item['url_key'])) {
$this->consoleOutput->writeln("ProductUrlKey: url_key not found {$identifier}");
- $this->log->addInfo('ProductUrlKey: url_key not found '.$identifier);
+ $this->log->info('ProductUrlKey: url_key not found '.$identifier);
}
$item['url_key'] = $this->getUrlKey($item['url_key'], $identifier);
}
@@ -178,7 +178,7 @@ public function getUrlKey($urlKey, $identifier)
$this->consoleOutput->writeln(
"Can not find available URL-key for {$identifier}, you might run into trouble"
);
- $this->log->addError("Can not find available URL-key for {$identifier}, you might run into trouble");
+ $this->log->error("Can not find available URL-key for {$identifier}, you might run into trouble");
}
/**
@@ -218,4 +218,4 @@ protected function reset()
$this->idToSku = [];
$this->urls = [];
}
-}
\ No newline at end of file
+}
diff --git a/src/RowModifier/SourceIterator.php b/src/RowModifier/SourceIterator.php
index 63d0939..b1aec52 100644
--- a/src/RowModifier/SourceIterator.php
+++ b/src/RowModifier/SourceIterator.php
@@ -84,7 +84,7 @@ public function __construct(
public function process()
{
$this->consoleOutput->writeln("SourceIterator: Adding information from stream");
- $this->log->addInfo('SourceIterator: Adding information from stream');
+ $this->log->info('SourceIterator: Adding information from stream');
$identifier = $this->identifier;
foreach ($this->iterator as $item) {
@@ -105,7 +105,7 @@ public function process()
$this->consoleOutput->writeln(
"SourceIterator: Item not found for {$id}"
);
- $this->log->addInfo("SourceIterator: Item not found for {$id}");
+ $this->log->info("SourceIterator: Item not found for {$id}");
continue 2;
}
diff --git a/src/RowModifier/TemplateFieldParser.php b/src/RowModifier/TemplateFieldParser.php
index 05098f6..01d9b9a 100644
--- a/src/RowModifier/TemplateFieldParser.php
+++ b/src/RowModifier/TemplateFieldParser.php
@@ -55,7 +55,7 @@ public function process()
try {
$item[$fieldName] = $this->filterTemplate->filter($template);
} catch (\Exception $e) {
- $this->log->addError($e->getMessage());
+ $this->log->error($e->getMessage());
$this->messageManager->addExceptionMessage($e);
}
}
diff --git a/src/Streamer/FileCsv.php b/src/Streamer/FileCsv.php
index 137bb3a..bb5df04 100644
--- a/src/Streamer/FileCsv.php
+++ b/src/Streamer/FileCsv.php
@@ -80,11 +80,11 @@ public function getIterator()
$this->consoleOutput->writeln(
"Streamer\FileCsv: Getting data from requestFile {$this->requestFile}"
);
- $this->log->addInfo('Streamer\FileCsv: Getting data from requestFile '.$this->requestFile);
+ $this->log->info('Streamer\FileCsv: Getting data from requestFile '.$this->requestFile);
$requestFile = $this->getRequestFile();
if (! file_exists($requestFile)) {
- $this->log->addCritical(sprintf('requestFile %s not found', $requestFile));
+ $this->log->critical(sprintf('requestFile %s not found', $requestFile));
throw new FileSystemException(__('requestFile %1 not found', $requestFile));
}
$requestFile = fopen($requestFile, 'r');
diff --git a/src/Streamer/HttpCsv.php b/src/Streamer/HttpCsv.php
index 5d69897..95e8ed8 100644
--- a/src/Streamer/HttpCsv.php
+++ b/src/Streamer/HttpCsv.php
@@ -132,7 +132,7 @@ public function getIterator()
$this->consoleOutput->write(
"Streamer\HttpCsv: Getting data from URL {$this->requestUrl}"
);
- $this->log->addInfo('Streamer\HttpCsv: Getting data from URL '.$this->requestUrl);
+ $this->log->info('Streamer\HttpCsv: Getting data from URL '.$this->requestUrl);
$stack = \GuzzleHttp\HandlerStack::create();
$stack->push(new \Kevinrob\GuzzleCache\CacheMiddleware(