Skip to content

Commit 1bab6d8

Browse files
authored
Update log.blade.php
1 parent 971243e commit 1bab6d8

File tree

1 file changed

+135
-124
lines changed

1 file changed

+135
-124
lines changed

src/views/log.blade.php

Lines changed: 135 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -1,137 +1,148 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
<head>
4-
<meta charset="utf-8">
5-
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6-
<meta name="viewport" content="width=device-width, initial-scale=1">
7-
<title>Laravel log viewer</title>
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1">
7+
<title>Laravel log viewer</title>
88

9-
<!-- Bootstrap -->
10-
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
11-
<link rel="stylesheet" href="https://cdn.datatables.net/plug-ins/9dcbecd42ad/integration/bootstrap/3/dataTables.bootstrap.css">
9+
<!-- Bootstrap -->
10+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
11+
<link rel="stylesheet"
12+
href="https://cdn.datatables.net/plug-ins/9dcbecd42ad/integration/bootstrap/3/dataTables.bootstrap.css">
1213

1314

15+
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
16+
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
17+
<!--[if lt IE 9]>
18+
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
19+
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
20+
<![endif]-->
21+
<style>
22+
body {
23+
padding: 25px;
24+
}
1425
15-
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
16-
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
17-
<!--[if lt IE 9]>
18-
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
19-
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
20-
<![endif]-->
21-
<style>
22-
body {
23-
padding: 25px;
24-
}
25-
h1 {
26-
font-size: 1.5em;
27-
margin-top: 0px;
28-
}
29-
.stack {
30-
font-size: 0.85em;
31-
}
32-
.date {
33-
min-width: 75px;
34-
}
35-
.text {
36-
word-break: break-all;
37-
}
38-
a.llv-active {
39-
z-index: 2;
40-
background-color: #f5f5f5;
41-
border-color: #777;
42-
}
43-
</style>
44-
</head>
45-
<body>
46-
<div class="container-fluid">
47-
<div class="row">
48-
<div class="col-sm-3 col-md-2 sidebar">
49-
<h1><span class="glyphicon glyphicon-calendar" aria-hidden="true"></span> Laravel Log Viewer</h1>
50-
<p class="text-muted"><i>by Rap2h</i></p>
51-
<div class="list-group">
52-
@foreach($files as $file)
53-
<a href="?l={{ base64_encode($file) }}" class="list-group-item @if ($current_file == $file) llv-active @endif">
54-
{{$file}}
55-
</a>
56-
@endforeach
57-
</div>
26+
h1 {
27+
font-size: 1.5em;
28+
margin-top: 0;
29+
}
30+
31+
.stack {
32+
font-size: 0.85em;
33+
}
34+
35+
.date {
36+
min-width: 75px;
37+
}
38+
39+
.text {
40+
word-break: break-all;
41+
}
42+
43+
a.llv-active {
44+
z-index: 2;
45+
background-color: #f5f5f5;
46+
border-color: #777;
47+
}
48+
</style>
49+
</head>
50+
<body>
51+
<div class="container-fluid">
52+
<div class="row">
53+
<div class="col-sm-3 col-md-2 sidebar">
54+
<h1><span class="glyphicon glyphicon-calendar" aria-hidden="true"></span> Laravel Log Viewer</h1>
55+
<p class="text-muted"><i>by Rap2h</i></p>
56+
<div class="list-group">
57+
@foreach($files as $file)
58+
<a href="?l={{ base64_encode($file) }}"
59+
class="list-group-item @if ($current_file == $file) llv-active @endif">
60+
{{$file}}
61+
</a>
62+
@endforeach
63+
</div>
64+
</div>
65+
<div class="col-sm-9 col-md-10 table-container">
66+
@if ($logs === null)
67+
<div>
68+
Log file >50M, please download it.
5869
</div>
59-
<div class="col-sm-9 col-md-10 table-container">
60-
@if ($logs === null)
61-
<div>
62-
Log file >50M, please download it.
63-
</div>
64-
@else
65-
<table id="table-log" class="table table-striped">
66-
<thead>
67-
<tr>
68-
<th>Level</th>
69-
<th>Context</th>
70-
<th>Date</th>
71-
<th>Content</th>
72-
</tr>
73-
</thead>
74-
<tbody>
70+
@else
71+
<table id="table-log" class="table table-striped">
72+
<thead>
73+
<tr>
74+
<th>Level</th>
75+
<th>Context</th>
76+
<th>Date</th>
77+
<th>Content</th>
78+
</tr>
79+
</thead>
80+
<tbody>
7581

76-
@foreach($logs as $key => $log)
77-
<tr data-display="stack{{{$key}}}">
78-
<td class="text-{{{$log['level_class']}}}"><span class="glyphicon glyphicon-{{{$log['level_img']}}}-sign" aria-hidden="true"></span> &nbsp;{{$log['level']}}</td>
79-
<td class="text">{{$log['context']}}</td>
80-
<td class="date">{{{$log['date']}}}</td>
81-
<td class="text">
82-
@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
83-
{{{$log['text']}}}
84-
@if (isset($log['in_file'])) <br />{{{$log['in_file']}}}@endif
85-
@if ($log['stack']) <div class="stack" id="stack{{{$key}}}" style="display: none; white-space: pre-wrap;">{{{ trim($log['stack']) }}}</div>@endif
86-
</td>
87-
</tr>
88-
@endforeach
82+
@foreach($logs as $key => $log)
83+
<tr data-display="stack{{{$key}}}">
84+
<td class="text-{{{$log['level_class']}}}"><span class="glyphicon glyphicon-{{{$log['level_img']}}}-sign"
85+
aria-hidden="true"></span> &nbsp;{{$log['level']}}</td>
86+
<td class="text">{{$log['context']}}</td>
87+
<td class="date">{{{$log['date']}}}</td>
88+
<td class="text">
89+
@if ($log['stack']) <a class="pull-right expand btn btn-default btn-xs"
90+
data-display="stack{{{$key}}}"><span
91+
class="glyphicon glyphicon-search"></span></a>@endif
92+
{{{$log['text']}}}
93+
@if (isset($log['in_file'])) <br/>{{{$log['in_file']}}}@endif
94+
@if ($log['stack'])
95+
<div class="stack" id="stack{{{$key}}}"
96+
style="display: none; white-space: pre-wrap;">{{{ trim($log['stack']) }}}
97+
</div>@endif
98+
</td>
99+
</tr>
100+
@endforeach
89101

90-
</tbody>
91-
</table>
102+
</tbody>
103+
</table>
104+
@endif
105+
<div>
106+
@if($current_file)
107+
<a href="?dl={{ base64_encode($current_file) }}"><span class="glyphicon glyphicon-download-alt"></span>
108+
Download file</a>
109+
-
110+
<a id="delete-log" href="?del={{ base64_encode($current_file) }}"><span
111+
class="glyphicon glyphicon-trash"></span> Delete file</a>
112+
@if(count($files) > 1)
113+
-
114+
<a id="delete-all-log" href="?delall=true"><span class="glyphicon glyphicon-trash"></span> Delete all files</a>
92115
@endif
93-
<div>
94-
@if($current_file)
95-
<a href="?dl={{ base64_encode($current_file) }}"><span class="glyphicon glyphicon-download-alt"></span> Download file</a>
96-
-
97-
<a id="delete-log" href="?del={{ base64_encode($current_file) }}"><span class="glyphicon glyphicon-trash"></span> Delete file</a>
98-
@if(count($files) > 1)
99-
-
100-
<a id="delete-all-log" href="?delall=true"><span class="glyphicon glyphicon-trash"></span> Delete all files</a>
101-
@endif
102-
@endif
103-
</div>
104-
</div>
116+
@endif
105117
</div>
106118
</div>
107-
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
108-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
109-
<script src="https://cdn.datatables.net/1.10.4/js/jquery.dataTables.min.js"></script>
110-
<script src="https://cdn.datatables.net/plug-ins/9dcbecd42ad/integration/bootstrap/3/dataTables.bootstrap.js"></script>
111-
<script>
112-
$(document).ready(function(){
113-
$('tr').on('click', function () {
114-
$('#' + $(this).data('display')).toggle();
115-
});
116-
$('#table-log').DataTable({
117-
"order": [ 1, 'desc' ],
118-
"stateSave": true,
119-
"stateSaveCallback": function (settings, data) {
120-
window.localStorage.setItem("datatable", JSON.stringify(data));
121-
},
122-
"stateLoadCallback": function (settings) {
123-
var data = JSON.parse(window.localStorage.getItem("datatable"));
124-
if (data) data.start = 0;
125-
return data;
126-
}
127-
});
128-
$('.table-container').on('click', '.expand', function(){
129-
$('#' + $(this).data('display')).toggle();
130-
});
131-
$('#delete-log, #delete-all-log').click(function(){
132-
return confirm('Are you sure?');
133-
});
134-
});
135-
</script>
136-
</body>
119+
</div>
120+
</div>
121+
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
122+
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
123+
<script src="https://cdn.datatables.net/1.10.4/js/jquery.dataTables.min.js"></script>
124+
<script src="https://cdn.datatables.net/plug-ins/9dcbecd42ad/integration/bootstrap/3/dataTables.bootstrap.js"></script>
125+
<script>
126+
$(document).ready(function () {
127+
$('.table-container tr').on('click', function () {
128+
$('#' + $(this).data('display')).toggle();
129+
});
130+
$('#table-log').DataTable({
131+
"order": [1, 'desc'],
132+
"stateSave": true,
133+
"stateSaveCallback": function (settings, data) {
134+
window.localStorage.setItem("datatable", JSON.stringify(data));
135+
},
136+
"stateLoadCallback": function (settings) {
137+
var data = JSON.parse(window.localStorage.getItem("datatable"));
138+
if (data) data.start = 0;
139+
return data;
140+
}
141+
});
142+
$('#delete-log, #delete-all-log').click(function () {
143+
return confirm('Are you sure?');
144+
});
145+
});
146+
</script>
147+
</body>
137148
</html>

0 commit comments

Comments
 (0)