Skip to content
Permalink
Browse files

Add context to table

  • Loading branch information
mallardduck committed Jul 2, 2016
1 parent cc955ff commit fa69c7f320cf48d887095eeb7b0b15000dca0565
Showing with 7 additions and 4 deletions.
  1. +5 −4 src/Rap2hpoutre/LaravelLogViewer/LaravelLogViewer.php
  2. +2 −0 src/views/log.blade.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])
);
}
@@ -66,6 +66,7 @@
<thead>
<tr>
<th>Level</th>
<th>Context</th>
<th>Date</th>
<th>Content</th>
</tr>
@@ -75,6 +76,7 @@
@foreach($logs as $key => $log)
<tr>
<td class="text-{{{$log['level_class']}}}"><span class="glyphicon glyphicon-{{{$log['level_img']}}}-sign" aria-hidden="true"></span> &nbsp;{{$log['level']}}</td>
<td class="text">{{$log['context']}}</td>
<td class="date">{{{$log['date']}}}</td>
<td class="text">
@if ($log['stack']) <a class="pull-right expand btn btn-default btn-xs" data-display="stack{{{$key}}}"><span class="glyphicon glyphicon-search"></span></a>@endif

0 comments on commit fa69c7f

Please sign in to comment.
You can’t perform that action at this time.