diff --git a/src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewer.php b/src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewer.php index 3252dcd..69751fe 100644 --- a/src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewer.php +++ b/src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewer.php @@ -13,7 +13,7 @@ class LaravelLogViewer { /** - * @var current file + * @var file */ private static $file; @@ -27,6 +27,14 @@ public static function setFile($file) } } + /** + * @return file + */ + public static function getFileName() + { + return basename(self::$file); + } + /** * @return array */ @@ -39,13 +47,14 @@ public static function all() $pattern = '/\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\].*/'; - if (self::$file) { - $file = File::get(self::$file); - } else { + + if (!self::$file) { $log_file = self::getFiles(); - $file = File::get($log_file[0]); + self::$file = $log_file[0]; } + $file = File::get(self::$file); + preg_match_all($pattern, $file, $headings); $log_data = preg_split($pattern, $file); diff --git a/src/controllers/LogViewerController.php b/src/controllers/LogViewerController.php index 8064694..2a0a3cf 100644 --- a/src/controllers/LogViewerController.php +++ b/src/controllers/LogViewerController.php @@ -18,8 +18,9 @@ public function index() return View::make('laravel-log-viewer::log', [ 'logs' => $logs, - 'files' => LaravelLogViewer::getFiles(true)] - ); + 'files' => LaravelLogViewer::getFiles(true), + 'current_file' => LaravelLogViewer::getFileName() + ]); } } diff --git a/src/views/log.blade.php b/src/views/log.blade.php index de269ff..8641b29 100644 --- a/src/views/log.blade.php +++ b/src/views/log.blade.php @@ -35,6 +35,11 @@ .text { word-break: break-all; } + a.llv-active { + z-index: 2; + background-color: #f5f5f5; + border-color: #777; + }
@@ -45,11 +50,13 @@by Rap2h