diff --git a/Helper/PayHelper.php b/Helper/PayHelper.php index caf7ccd7..540c3f18 100644 --- a/Helper/PayHelper.php +++ b/Helper/PayHelper.php @@ -8,6 +8,8 @@ class PayHelper extends \Magento\Framework\App\Helper\AbstractHelper { + const PAY_LOG_PREFIX = 'PAY.: '; + private static $objectManager; private static $store; @@ -68,6 +70,20 @@ public static function logDebug($text, $params = array(), $store = null) self::writeLog($text, 'debug', $params, $store); } + /** + * Logs while bypassing the loglevel setting. + * + * @param $text + * @param array $params + * @param null $store + */ + public static function log($text, $params = array(), $store = null) + { + $objectManager = self::getObjectManager(); + $logger = $objectManager->get(\Psr\Log\LoggerInterface::class); + $logger->notice(PayHelper::PAY_LOG_PREFIX . $text, $params); + } + public static function writeLog($text, $type, $params, $store) { $objectManager = self::getObjectManager(); @@ -77,8 +93,7 @@ public static function writeLog($text, $type, $params, $store) $level = $store->getConfig('payment/paynl/logging_level'); if (self::hasCorrectLevel($level, $type)) { - $prefix = 'PAY.: '; - $text = $prefix . $text; + $text = PayHelper::PAY_LOG_PREFIX . $text; if (!is_array($params)) { $params = array(); } diff --git a/Setup/Patch/Data/Install.php b/Setup/Patch/Data/Install.php index 7c931e3f..40c46da0 100644 --- a/Setup/Patch/Data/Install.php +++ b/Setup/Patch/Data/Install.php @@ -43,11 +43,13 @@ public function apply() $this->moduleDataSetup->startSetup(); if (empty($this->store->getConfig('payment/paynl/apitoken')) && empty($this->store->getConfig('payment/paynl/serviceid'))) { - payHelper::logDebug('Installing module.'); + payHelper::log('Installing module'); $this->configWriter->save('payment/paynl/order_description_prefix', 'Order '); $this->configWriter->save('payment/paynl/image_style', 'newest'); $this->configWriter->save('payment/paynl/pay_style_checkout', 1); $this->configWriter->save('payment/paynl/icon_size', 'small'); + } else { + payHelper::logInfo('Installing, keeping defaults.'); } $this->moduleDataSetup->endSetup(); diff --git a/Setup/Patch/Data/UpdateFashionGiftcard.php b/Setup/Patch/Data/UpdateFashionGiftcard.php index 2162105b..6f7fd057 100644 --- a/Setup/Patch/Data/UpdateFashionGiftcard.php +++ b/Setup/Patch/Data/UpdateFashionGiftcard.php @@ -42,7 +42,7 @@ public function apply() { $this->moduleDataSetup->startSetup(); - payHelper::logDebug('Apply patch: updateFashionGiftcard.'); + payHelper::log('Apply patch: updateFashionGiftcard.'); $connection = $this->resourceConnection->getConnection(); $tableName = $this->resourceConnection->getTableName('core_config_data'); @@ -54,7 +54,7 @@ public function apply() if (!$result) { return; } - payHelper::logDebug('updateFashionGiftcard result ' . $result); + payHelper::log('updateFashionGiftcard result ' . $result); if ($result == '1699') { # Update the incorrect profileid. $this->resourceConfig->saveConfig($path, '1669', 'default', 0);