Skip to content

Commit

Permalink
Merge pull request #369 from zorn-v/patch-1
Browse files Browse the repository at this point in the history
Page load speed improve
  • Loading branch information
arcanedev-maroc authored Sep 6, 2021
2 parents d716692 + 57ba662 commit 6802e6b
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Utilities/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
use Arcanedev\LogViewer\Contracts\Utilities\Filesystem as FilesystemContract;
use Arcanedev\LogViewer\Contracts\Utilities\LogLevels as LogLevelsContract;
use Arcanedev\LogViewer\Entities\LogCollection;
use Arcanedev\LogViewer\Entities\Log;
use Arcanedev\LogViewer\Exceptions\LogNotFoundException;
use Arcanedev\LogViewer\Tables\StatsTable;

/**
Expand Down Expand Up @@ -196,7 +198,12 @@ public function paginate($perPage = 30)
*/
public function log($date)
{
return $this->logs()->log($date);
$dates = $this->filesystem->dates(true);
if (!isset($dates[$date])) {
throw new LogNotFoundException("Log not found in this date [$date]");
}

return new Log($date, $dates[$date], $this->filesystem->read($date));
}

/**
Expand All @@ -221,7 +228,7 @@ public function get($date)
*/
public function entries($date, $level = 'all')
{
return $this->logs()->entries($date, $level);
return $this->log($date)->entries($level);
}

/**
Expand Down Expand Up @@ -253,7 +260,7 @@ public function statsTable($locale = null)
*/
public function dates()
{
return $this->logs()->dates();
return $this->filesystem->dates();
}

/**
Expand Down

0 comments on commit 6802e6b

Please sign in to comment.