From 845dbc5cc0442833c26cbd4c2aa6e858ab7822c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=AF=D1=86=D0=B5=D0=BD=D0=BA=D0=BE=20=D0=90=D0=BD=D0=B4?= =?UTF-8?q?=D1=80=D0=B5=D0=B9?= Date: Thu, 2 Jun 2022 17:24:32 +0300 Subject: [PATCH] fix: log prepend --- src/Filesystem.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Filesystem.php b/src/Filesystem.php index 54a3005..e12f50f 100644 --- a/src/Filesystem.php +++ b/src/Filesystem.php @@ -102,6 +102,18 @@ public function readByDate(string $date): string return $log; } + /** + * Get the log file path. + * + * @param string $date + * + * @return string + */ + public function getFormatterPath($date) + { + return $this->storagePath . DIRECTORY_SEPARATOR . 'mails' . DIRECTORY_SEPARATOR . 'mails-' . $date . '.log'; + } + /** * Get the log file path. * @@ -112,7 +124,7 @@ public function readByDate(string $date): string */ public function getLogPath(string $date): string { - $path = $this->storagePath . DIRECTORY_SEPARATOR . 'mails' . DIRECTORY_SEPARATOR . 'mails-' . $date . '.log'; + $path = $this->getFormatterPath($date); if (!$this->filesystem->exists($path)) { throw new FileNotFoundException('File ' . $path . ' not found'); @@ -132,7 +144,7 @@ public function getLogPath(string $date): string */ public function prepend(string $date, string $content) { - $this->filesystem->prepend($this->getLogPath($date), $content); + $this->filesystem->prepend($this->getFormatterPath($date), $content); } /**