Skip to content

Commit

Permalink
fix: log prepend
Browse files Browse the repository at this point in the history
  • Loading branch information
Яценко Андрей committed Jun 2, 2022
1 parent 0ea6cd9 commit 845dbc5
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -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');
Expand All @@ -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);
}

/**
Expand Down

0 comments on commit 845dbc5

Please sign in to comment.