From fa69c7f320cf48d887095eeb7b0b15000dca0565 Mon Sep 17 00:00:00 2001 From: Dan Pock Date: Fri, 1 Jul 2016 20:21:01 -0400 Subject: [PATCH] Add context to table --- src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewer.php | 9 +++++---- src/views/log.blade.php | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewer.php b/src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewer.php index 6e9fb5e..b0a79e7 100644 --- a/src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewer.php +++ b/src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewer.php @@ -117,17 +117,18 @@ public static function all() foreach ($log_levels as $level_key => $level_value) { if (strpos(strtolower($h[$i]), '.' . $level_value)) { - preg_match('/^\[(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})\].*?\.' . $level_key . ': (.*?)( in .*?:[0-9]+)?$/', $h[$i], $current); + preg_match('/^\[(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})\].*?(\w+)\.' . $level_key . ': (.*?)( in .*?:[0-9]+)?$/', $h[$i], $current); - if (!isset($current[2])) continue; + if (!isset($current[3])) continue; $log[] = array( + 'context' => $current[2], 'level' => $level_value, 'level_class' => self::$levels_classes[$level_value], 'level_img' => self::$levels_imgs[$level_value], 'date' => $current[1], - 'text' => $current[2], - 'in_file' => isset($current[3]) ? $current[3] : null, + 'text' => $current[3], + 'in_file' => isset($current[4]) ? $current[4] : null, 'stack' => preg_replace("/^\n*/", '', $log_data[$i]) ); } diff --git a/src/views/log.blade.php b/src/views/log.blade.php index 1f497ae..a3cd73d 100644 --- a/src/views/log.blade.php +++ b/src/views/log.blade.php @@ -66,6 +66,7 @@ Level + Context Date Content @@ -75,6 +76,7 @@ @foreach($logs as $key => $log)  {{$log['level']}} + {{$log['context']}} {{{$log['date']}}} @if ($log['stack']) @endif