From 71f68eea7c9d3cfee6673f1f41726cd513dc779e Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Fri, 1 Mar 2024 06:14:37 +0100 Subject: [PATCH] Adding env variable to enable disable stdout logger (#163) --- src/Handlers/Logging/DefaultLogger.php | 5 ++++- tests/Buckaroo/Payments/KBCTest.php | 2 ++ tests/Buckaroo/Payments/SepaTest.php | 2 ++ tests/Buckaroo/Payments/SofortTest.php | 2 ++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Handlers/Logging/DefaultLogger.php b/src/Handlers/Logging/DefaultLogger.php index 70650d7f..a0b4fccc 100644 --- a/src/Handlers/Logging/DefaultLogger.php +++ b/src/Handlers/Logging/DefaultLogger.php @@ -37,7 +37,10 @@ class DefaultLogger implements Subject, LoggerInterface */ public function __construct() { - $this->attach(new Monolog()); + if (($_ENV['BPE_LOG'] ?? false) === 'true') + { + $this->attach(new Monolog()); + } if (($_ENV['BPE_REPORT_ERROR'] ?? false) === 'true') { diff --git a/tests/Buckaroo/Payments/KBCTest.php b/tests/Buckaroo/Payments/KBCTest.php index 5fa57174..ce0a2669 100644 --- a/tests/Buckaroo/Payments/KBCTest.php +++ b/tests/Buckaroo/Payments/KBCTest.php @@ -24,6 +24,8 @@ class KBCTest extends BuckarooTestCase { + protected array $paymentPayload; + protected function setUp(): void { $this->paymentPayload = ([ diff --git a/tests/Buckaroo/Payments/SepaTest.php b/tests/Buckaroo/Payments/SepaTest.php index 5a6194ac..918fcdd7 100644 --- a/tests/Buckaroo/Payments/SepaTest.php +++ b/tests/Buckaroo/Payments/SepaTest.php @@ -6,6 +6,8 @@ class SepaTest extends BuckarooTestCase { + protected array $paymentPayload; + protected function setUp(): void { $this->paymentPayload = ([ diff --git a/tests/Buckaroo/Payments/SofortTest.php b/tests/Buckaroo/Payments/SofortTest.php index ef4759da..e0656911 100644 --- a/tests/Buckaroo/Payments/SofortTest.php +++ b/tests/Buckaroo/Payments/SofortTest.php @@ -24,6 +24,8 @@ class SofortTest extends BuckarooTestCase { + protected array $paymentPayload; + protected function setUp(): void { $this->paymentPayload = ([