From 35e9d82c616f9bdb010f621b1378fcc88d8f06a6 Mon Sep 17 00:00:00 2001 From: rap2hpoutre Date: Thu, 4 Dec 2014 14:18:17 +0100 Subject: [PATCH] Update LaravelLogViewer.php --- .../LaravelLogViewer/LaravelLogViewer.php | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewer.php b/src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewer.php index 21410c3..3252dcd 100644 --- a/src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewer.php +++ b/src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewer.php @@ -5,11 +5,21 @@ use Psr\Log\LogLevel; use ReflectionClass; +/** + * Class LaravelLogViewer + * @package Rap2hpoutre\LaravelLogViewer + */ class LaravelLogViewer { + /** + * @var current file + */ private static $file; + /** + * @param $file + */ public static function setFile($file) { if (File::exists(storage_path() . '/logs/' . $file)) { @@ -17,6 +27,9 @@ public static function setFile($file) } } + /** + * @return array + */ public static function all() { $log = array(); @@ -33,8 +46,6 @@ public static function all() $file = File::get($log_file[0]); } - - preg_match_all($pattern, $file, $headings); $log_data = preg_split($pattern, $file); @@ -80,7 +91,7 @@ public static function all() 'date' => $current[1], 'text' => $current[2], 'in_file' => isset($current[3]) ? $current[3] : null, - 'stack' => $log_data[$i], + 'stack' => preg_replace("/^\n*/", '', $log_data[$i]) ); } } @@ -91,6 +102,10 @@ public static function all() return $log; } + /** + * @param bool $basename + * @return array + */ public static function getFiles($basename = false) { $files = glob(storage_path() . '/logs/*');