From b5c7f22b23b2b8cba888745a9264948a8ab9bbd7 Mon Sep 17 00:00:00 2001 From: Deniz Burucu Date: Wed, 30 Jan 2019 16:00:15 +0100 Subject: [PATCH 1/5] Log-file-path was not be setted correctly. --- src/Sofort/SofortLib/FileLogger.php | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/Sofort/SofortLib/FileLogger.php b/src/Sofort/SofortLib/FileLogger.php index cfdcd9d..460d710 100644 --- a/src/Sofort/SofortLib/FileLogger.php +++ b/src/Sofort/SofortLib/FileLogger.php @@ -61,9 +61,11 @@ public function __construct($path = '') { $srcDir = dirname(dirname(dirname(__FILE__))); - $this->_logfilePath = ($path != '') ? $path : $srcDir . '/logs/log.txt'; - $this->_errorLogfilePath = $srcDir . '/logs/error_log.txt'; - $this->_warningsLogfilePath = $srcDir . '/logs/warning_log.txt'; + $path = rtrim(rtrim($path, '/'),'\\'); + if ($path == '') { + $path = $srcDir; + } + $this->setLogfilePath($path); } @@ -88,7 +90,10 @@ public function log($message, $log = 'log') */ public function setLogfilePath($path) { - $this->_logfilePath = $path; + $path = rtrim(rtrim($path, '/'),'\\'); + $this->_logfilePath = $path . '/log.txt'; + $this->_errorLogfilePath = $path . '/error_log.txt'; + $this->_warningsLogfilePath = rtrim($path, '/') . '/warning_log.txt'; } From 928dc1cff7dbcc60a11274662c3cd3daa9fe23f6 Mon Sep 17 00:00:00 2001 From: Deniz Burucu Date: Wed, 30 Jan 2019 20:24:04 +0100 Subject: [PATCH 2/5] Update FileLogger.php Logs directory failure --- src/Sofort/SofortLib/FileLogger.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Sofort/SofortLib/FileLogger.php b/src/Sofort/SofortLib/FileLogger.php index 460d710..e7b3844 100644 --- a/src/Sofort/SofortLib/FileLogger.php +++ b/src/Sofort/SofortLib/FileLogger.php @@ -63,7 +63,7 @@ public function __construct($path = '') $path = rtrim(rtrim($path, '/'),'\\'); if ($path == '') { - $path = $srcDir; + $path = $srcDir.'/logs'; } $this->setLogfilePath($path); } @@ -175,4 +175,4 @@ protected function _logRotate() return false; } -} \ No newline at end of file +} From bc80b7a2d2b15e0e4e2982f53ad5bfd804fd52ea Mon Sep 17 00:00:00 2001 From: Deniz Burucu Date: Thu, 31 Jan 2019 08:05:49 +0100 Subject: [PATCH 3/5] correction of the path --- src/Sofort/SofortLib/FileLogger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Sofort/SofortLib/FileLogger.php b/src/Sofort/SofortLib/FileLogger.php index e7b3844..1e71527 100644 --- a/src/Sofort/SofortLib/FileLogger.php +++ b/src/Sofort/SofortLib/FileLogger.php @@ -93,7 +93,7 @@ public function setLogfilePath($path) $path = rtrim(rtrim($path, '/'),'\\'); $this->_logfilePath = $path . '/log.txt'; $this->_errorLogfilePath = $path . '/error_log.txt'; - $this->_warningsLogfilePath = rtrim($path, '/') . '/warning_log.txt'; + $this->_warningsLogfilePath = $path . '/warning_log.txt'; } From 715f3277a11012fad67c8e1e243e0211c7c387d3 Mon Sep 17 00:00:00 2001 From: Deniz Burucu Date: Thu, 31 Jan 2019 08:15:17 +0100 Subject: [PATCH 4/5] FileLoggerTest correction --- tests/unit/FileLoggerTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/unit/FileLoggerTest.php b/tests/unit/FileLoggerTest.php index c23c06e..28ba851 100644 --- a/tests/unit/FileLoggerTest.php +++ b/tests/unit/FileLoggerTest.php @@ -67,9 +67,9 @@ public function testLogWriting() public function testSetLogfilePath() { $SofortLibLogger = new FileLogger('wusel'); - $this->assertAttributeEquals('wusel', '_logfilePath', $SofortLibLogger); + $this->assertAttributeEquals('wusel/log.txt', '_logfilePath', $SofortLibLogger); $SofortLibLogger->setLogfilePath('test'); - $this->assertAttributeEquals('test', '_logfilePath', $SofortLibLogger); + $this->assertAttributeEquals('test/log.txt', '_logfilePath', $SofortLibLogger); } } \ No newline at end of file From 834b8e0c51529c2db8533d2b1e58578d7f56fb9c Mon Sep 17 00:00:00 2001 From: Deniz Burucu Date: Thu, 31 Jan 2019 08:29:18 +0100 Subject: [PATCH 5/5] ignore eclipse .settings folder --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 35b4f82..80cfecd 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ /.DS_Store /vendor /composer.lock +/.settings/