log viewer
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
"milon/barcode": "^7.0",
|
||||
"predis/predis": "^1.1",
|
||||
"pusher/pusher-php-server": "~4.0",
|
||||
"rap2hpoutre/laravel-log-viewer": "^1.7",
|
||||
"simplesoftwareio/simple-qrcode": "^4.1",
|
||||
"spatie/laravel-medialibrary": "^7.19",
|
||||
"twilio/sdk": "^6.16",
|
||||
|
||||
Generated
+64
-1
@@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "79aad5a75460ed20426a86ab992dab8e",
|
||||
"content-hash": "4f26944f77caea167bb120f5fe970820",
|
||||
"packages": [
|
||||
{
|
||||
"name": "almasaeed2010/adminlte",
|
||||
@@ -3337,6 +3337,69 @@
|
||||
],
|
||||
"time": "2020-08-18T17:17:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "rap2hpoutre/laravel-log-viewer",
|
||||
"version": "v1.7.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/rap2hpoutre/laravel-log-viewer.git",
|
||||
"reference": "27392d29234b6ff38a456454558f4bcc40cc837a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/rap2hpoutre/laravel-log-viewer/zipball/27392d29234b6ff38a456454558f4bcc40cc837a",
|
||||
"reference": "27392d29234b6ff38a456454558f4bcc40cc837a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/support": "4.2.*|5.*|^6.0|^7.0|^8.0",
|
||||
"php": ">=5.4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"orchestra/testbench": "3.7.*",
|
||||
"phpunit/phpunit": "^7"
|
||||
},
|
||||
"type": "laravel-package",
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Rap2hpoutre\\LaravelLogViewer\\LaravelLogViewerServiceProvider"
|
||||
]
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"src/controllers"
|
||||
],
|
||||
"psr-0": {
|
||||
"Rap2hpoutre\\LaravelLogViewer\\": "src/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "rap2hpoutre",
|
||||
"email": "raphaelht@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "A Laravel log reader",
|
||||
"keywords": [
|
||||
"laravel",
|
||||
"log",
|
||||
"log-reader",
|
||||
"log-viewer",
|
||||
"logging",
|
||||
"lumen"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/rap2hpoutre/laravel-log-viewer/issues",
|
||||
"source": "https://github.com/rap2hpoutre/laravel-log-viewer/tree/master"
|
||||
},
|
||||
"time": "2020-09-08T12:21:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sabberworm/php-css-parser",
|
||||
"version": "8.3.1",
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Pattern and storage path settings
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| The env key for pattern and storage path with a default value
|
||||
|
|
||||
*/
|
||||
'max_file_size' => 52428800, // size in Byte
|
||||
'pattern' => env('LOGVIEWER_PATTERN', '*.log'),
|
||||
'storage_path' => env('LOGVIEWER_STORAGE_PATH', storage_path('logs')),
|
||||
];
|
||||
@@ -0,0 +1,339 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||
<meta name="robots" content="noindex, nofollow">
|
||||
<title>Laravel log viewer</title>
|
||||
<link rel="stylesheet"
|
||||
href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css"
|
||||
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
|
||||
crossorigin="anonymous">
|
||||
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.16/css/dataTables.bootstrap4.min.css">
|
||||
<style>
|
||||
body {
|
||||
padding: 25px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.5em;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
#table-log {
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
font-size: 0.85rem;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.btn {
|
||||
font-size: 0.7rem;
|
||||
}
|
||||
|
||||
.stack {
|
||||
font-size: 0.85em;
|
||||
}
|
||||
|
||||
.date {
|
||||
min-width: 75px;
|
||||
}
|
||||
|
||||
.text {
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
a.llv-active {
|
||||
z-index: 2;
|
||||
background-color: #f5f5f5;
|
||||
border-color: #777;
|
||||
}
|
||||
|
||||
.list-group-item {
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.folder {
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
||||
.div-scroll {
|
||||
height: 80vh;
|
||||
overflow: hidden auto;
|
||||
}
|
||||
.nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* DARK MODE CSS
|
||||
*/
|
||||
|
||||
body[data-theme="dark"] {
|
||||
background-color: #151515;
|
||||
color: #cccccc;
|
||||
}
|
||||
|
||||
[data-theme="dark"] a {
|
||||
color: #4da3ff;
|
||||
}
|
||||
|
||||
[data-theme="dark"] a:hover {
|
||||
color: #a8d2ff;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .list-group-item {
|
||||
background-color: #1d1d1d;
|
||||
border-color: #444;
|
||||
}
|
||||
|
||||
[data-theme="dark"] a.llv-active {
|
||||
background-color: #0468d2;
|
||||
border-color: rgba(255, 255, 255, 0.125);
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
[data-theme="dark"] a.list-group-item:focus, [data-theme="dark"] a.list-group-item:hover {
|
||||
background-color: #273a4e;
|
||||
border-color: rgba(255, 255, 255, 0.125);
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .table td, [data-theme="dark"] .table th,[data-theme="dark"] .table thead th {
|
||||
border-color:#616161;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .page-item.disabled .page-link {
|
||||
color: #8a8a8a;
|
||||
background-color: #151515;
|
||||
border-color: #5a5a5a;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .page-link {
|
||||
background-color: #151515;
|
||||
border-color: #5a5a5a;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .page-item.active .page-link {
|
||||
color: #fff;
|
||||
background-color: #0568d2;
|
||||
border-color: #007bff;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .page-link:hover {
|
||||
color: #ffffff;
|
||||
background-color: #0051a9;
|
||||
border-color: #0568d2;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .form-control {
|
||||
border: 1px solid #464646;
|
||||
background-color: #151515;
|
||||
color: #bfbfbf;
|
||||
}
|
||||
|
||||
[data-theme="dark"] .form-control:focus {
|
||||
color: #bfbfbf;
|
||||
background-color: #212121;
|
||||
border-color: #4a4a4a;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<script>
|
||||
function initTheme() {
|
||||
const darkThemeSelected =
|
||||
localStorage.getItem('darkSwitch') !== null &&
|
||||
localStorage.getItem('darkSwitch') === 'dark';
|
||||
darkSwitch.checked = darkThemeSelected;
|
||||
darkThemeSelected ? document.body.setAttribute('data-theme', 'dark') :
|
||||
document.body.removeAttribute('data-theme');
|
||||
}
|
||||
|
||||
function resetTheme() {
|
||||
if (darkSwitch.checked) {
|
||||
document.body.setAttribute('data-theme', 'dark');
|
||||
localStorage.setItem('darkSwitch', 'dark');
|
||||
} else {
|
||||
document.body.removeAttribute('data-theme');
|
||||
localStorage.removeItem('darkSwitch');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col sidebar mb-3">
|
||||
<h1><i class="fa fa-calendar" aria-hidden="true"></i> Laravel Log Viewer</h1>
|
||||
<p class="text-muted"><i>by Rap2h</i></p>
|
||||
|
||||
<div class="custom-control custom-switch" style="padding-bottom:20px;">
|
||||
<input type="checkbox" class="custom-control-input" id="darkSwitch">
|
||||
<label class="custom-control-label" for="darkSwitch" style="margin-top: 6px;">Dark Mode</label>
|
||||
</div>
|
||||
|
||||
<div class="list-group div-scroll">
|
||||
@foreach($folders as $folder)
|
||||
<div class="list-group-item">
|
||||
<a href="?f={{ \Illuminate\Support\Facades\Crypt::encrypt($folder) }}">
|
||||
<span class="fa fa-folder"></span> {{$folder}}
|
||||
</a>
|
||||
@if ($current_folder == $folder)
|
||||
<div class="list-group folder">
|
||||
@foreach($folder_files as $file)
|
||||
<a href="?l={{ \Illuminate\Support\Facades\Crypt::encrypt($file) }}&f={{ \Illuminate\Support\Facades\Crypt::encrypt($folder) }}"
|
||||
class="list-group-item @if ($current_file == $file) llv-active @endif">
|
||||
{{$file}}
|
||||
</a>
|
||||
@endforeach
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endforeach
|
||||
@foreach($files as $file)
|
||||
<a href="?l={{ \Illuminate\Support\Facades\Crypt::encrypt($file) }}"
|
||||
class="list-group-item @if ($current_file == $file) llv-active @endif">
|
||||
{{$file}}
|
||||
</a>
|
||||
@endforeach
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-10 table-container">
|
||||
@if ($logs === null)
|
||||
<div>
|
||||
Log file >50M, please download it.
|
||||
</div>
|
||||
@else
|
||||
<table id="table-log" class="table table-striped" data-ordering-index="{{ $standardFormat ? 2 : 0 }}">
|
||||
<thead>
|
||||
<tr>
|
||||
@if ($standardFormat)
|
||||
<th>Level</th>
|
||||
<th>Context</th>
|
||||
<th>Date</th>
|
||||
@else
|
||||
<th>Line number</th>
|
||||
@endif
|
||||
<th>Content</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
@foreach($logs as $key => $log)
|
||||
<tr data-display="stack{{{$key}}}">
|
||||
@if ($standardFormat)
|
||||
<td class="nowrap text-{{{$log['level_class']}}}">
|
||||
<span class="fa fa-{{{$log['level_img']}}}" aria-hidden="true"></span> {{$log['level']}}
|
||||
</td>
|
||||
<td class="text">{{$log['context']}}</td>
|
||||
@endif
|
||||
<td class="date">{{{$log['date']}}}</td>
|
||||
<td class="text">
|
||||
@if ($log['stack'])
|
||||
<button type="button"
|
||||
class="float-right expand btn btn-outline-dark btn-sm mb-2 ml-2"
|
||||
data-display="stack{{{$key}}}">
|
||||
<span class="fa fa-search"></span>
|
||||
</button>
|
||||
@endif
|
||||
{{{$log['text']}}}
|
||||
@if (isset($log['in_file']))
|
||||
<br/>{{{$log['in_file']}}}
|
||||
@endif
|
||||
@if ($log['stack'])
|
||||
<div class="stack" id="stack{{{$key}}}"
|
||||
style="display: none; white-space: pre-wrap;">{{{ trim($log['stack']) }}}
|
||||
</div>
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
@endif
|
||||
<div class="p-3">
|
||||
@if($current_file)
|
||||
<a href="?dl={{ \Illuminate\Support\Facades\Crypt::encrypt($current_file) }}{{ ($current_folder) ? '&f=' . \Illuminate\Support\Facades\Crypt::encrypt($current_folder) : '' }}">
|
||||
<span class="fa fa-download"></span> Download file
|
||||
</a>
|
||||
-
|
||||
<a id="clean-log" href="?clean={{ \Illuminate\Support\Facades\Crypt::encrypt($current_file) }}{{ ($current_folder) ? '&f=' . \Illuminate\Support\Facades\Crypt::encrypt($current_folder) : '' }}">
|
||||
<span class="fa fa-sync"></span> Clean file
|
||||
</a>
|
||||
-
|
||||
<a id="delete-log" href="?del={{ \Illuminate\Support\Facades\Crypt::encrypt($current_file) }}{{ ($current_folder) ? '&f=' . \Illuminate\Support\Facades\Crypt::encrypt($current_folder) : '' }}">
|
||||
<span class="fa fa-trash"></span> Delete file
|
||||
</a>
|
||||
@if(count($files) > 1)
|
||||
-
|
||||
<a id="delete-all-log" href="?delall=true{{ ($current_folder) ? '&f=' . \Illuminate\Support\Facades\Crypt::encrypt($current_folder) : '' }}">
|
||||
<span class="fa fa-trash-alt"></span> Delete all files
|
||||
</a>
|
||||
@endif
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- jQuery for Bootstrap -->
|
||||
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
|
||||
integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
|
||||
crossorigin="anonymous"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
|
||||
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
|
||||
crossorigin="anonymous"></script>
|
||||
<!-- FontAwesome -->
|
||||
<script defer src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script>
|
||||
<!-- Datatables -->
|
||||
<script type="text/javascript" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
|
||||
<script type="text/javascript" src="https://cdn.datatables.net/1.10.16/js/dataTables.bootstrap4.min.js"></script>
|
||||
|
||||
<script>
|
||||
|
||||
// dark mode by https://github.com/coliff/dark-mode-switch
|
||||
const darkSwitch = document.getElementById('darkSwitch');
|
||||
|
||||
// this is here so we can get the body dark mode before the page displays
|
||||
// otherwise the page will be white for a second...
|
||||
initTheme();
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
if (darkSwitch) {
|
||||
initTheme();
|
||||
darkSwitch.addEventListener('change', () => {
|
||||
resetTheme();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// end darkmode js
|
||||
|
||||
$(document).ready(function () {
|
||||
$('.table-container tr').on('click', function () {
|
||||
$('#' + $(this).data('display')).toggle();
|
||||
});
|
||||
$('#table-log').DataTable({
|
||||
"order": [$('#table-log').data('orderingIndex'), 'desc'],
|
||||
"stateSave": true,
|
||||
"stateSaveCallback": function (settings, data) {
|
||||
window.localStorage.setItem("datatable", JSON.stringify(data));
|
||||
},
|
||||
"stateLoadCallback": function (settings) {
|
||||
var data = JSON.parse(window.localStorage.getItem("datatable"));
|
||||
if (data) data.start = 0;
|
||||
return data;
|
||||
}
|
||||
});
|
||||
$('#delete-log, #clean-log, #delete-all-log').click(function () {
|
||||
return confirm('Are you sure?');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
+1
-1
@@ -41,7 +41,7 @@ Route::get('test', function () {
|
||||
|
||||
// });
|
||||
|
||||
|
||||
Route::get('logs', '\Rap2hpoutre\LaravelLogViewer\LogViewerController@index');
|
||||
|
||||
Route::get('/welcome',function(){
|
||||
|
||||
|
||||
Reference in New Issue
Block a user