Skip to content

Commit

Permalink
Update LaravelLogViewer.php
Browse files Browse the repository at this point in the history
  • Loading branch information
rap2hpoutre committed Apr 12, 2015
1 parent d97dec6 commit aedf26d
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewer.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,16 @@ public static function all()
$log_levels = self::getLogLevels();

$pattern = '/\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\].*/';

if (!self::$file) {
$log_file = self::getFiles();
if(!count($log_file)) {
return [];
}
self::$file = $log_file[0];
}

$file = self::getCurrentFile();
$file = File::get(self::$file);

preg_match_all($pattern, $file, $headings);

Expand Down Expand Up @@ -122,22 +130,6 @@ public static function getFiles($basename = false)
return $files;
}

/**
* @return array
*/
private static function getCurrentFile()
{
if (!self::$file) {
$log_file = self::getFiles();
if(!count($log_file)) {
return [];
}
self::$file = $log_file[0];
}

return File::get(self::$file);
}

/**
* @return array
*/
Expand Down

0 comments on commit aedf26d

Please sign in to comment.