mirror of
https://github.com/freescout-helpdesk/freescout.git
synced 2024-11-24 11:22:42 +01:00
Application logs
This commit is contained in:
parent
b69c9e50f8
commit
489669591a
2
.gitignore
vendored
2
.gitignore
vendored
@ -20,7 +20,7 @@ composer.phar
|
||||
#composer.lock
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
/.htaccess
|
||||
#/.htaccess
|
||||
/public/css/builds/
|
||||
/public/js/builds/
|
||||
/public/.well-known
|
||||
|
@ -11,6 +11,7 @@ class ActivityLog extends Activity
|
||||
const NAME_EMAILS_SENDING = 'send_errors';
|
||||
const NAME_EMAILS_FETCHING = 'fetch_errors';
|
||||
const NAME_SYSTEM = 'system';
|
||||
const NAME_APP_LOGS = 'app';
|
||||
|
||||
const DESCRIPTION_USER_LOGIN = 'login';
|
||||
const DESCRIPTION_USER_LOGOUT = 'logout';
|
||||
@ -83,6 +84,8 @@ class ActivityLog extends Activity
|
||||
return __('Fetch Errors');
|
||||
case self::NAME_SYSTEM:
|
||||
return __('System');
|
||||
case self::NAME_APP_LOGS:
|
||||
return __('App Logs');
|
||||
default:
|
||||
return ucfirst($log_name);
|
||||
}
|
||||
|
@ -138,6 +138,7 @@ class SecureController extends Controller
|
||||
}
|
||||
|
||||
array_unshift($names, ActivityLog::NAME_OUT_EMAILS);
|
||||
array_push($names, ActivityLog::NAME_APP_LOGS);
|
||||
|
||||
if (!in_array($name, $names)) {
|
||||
$names[] = $name;
|
||||
|
@ -11,8 +11,10 @@ class ResponseHeaders
|
||||
$response = $next($request);
|
||||
|
||||
// Disable caching
|
||||
$response->header('Pragma', 'no-cache');
|
||||
$response->header('Cache-Control', 'no-cache, max-age=0, must-revalidate, no-store');
|
||||
if (method_exists($response, 'header')) {
|
||||
$response->header('Pragma', 'no-cache');
|
||||
$response->header('Cache-Control', 'no-cache, max-age=0, must-revalidate, no-store');
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
@ -22,7 +22,8 @@
|
||||
"barryvdh/laravel-translation-manager": "v0.5.0",
|
||||
"chumper/zipper": "v1.0.2",
|
||||
"rachidlaasri/laravel-installer": "4.0.2",
|
||||
"kitetail/zttp": "v0.4.0"
|
||||
"kitetail/zttp": "v0.4.0",
|
||||
"rap2hpoutre/laravel-log-viewer": "v0.22.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"barryvdh/laravel-debugbar": "v2.4.3",
|
||||
|
71
composer.lock
generated
71
composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "f0bd9518872e95561e385b1738e8e6bd",
|
||||
"content-hash": "0d4a209a58196e3d3e880a0cabc526cb",
|
||||
"packages": [
|
||||
{
|
||||
"name": "anahkiasen/underscore-php",
|
||||
@ -1385,16 +1385,16 @@
|
||||
},
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
"version": "1.23.0",
|
||||
"version": "1.24.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Seldaek/monolog.git",
|
||||
"reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4"
|
||||
"reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd8c787753b3a2ad11bc60c063cff1358a32a3b4",
|
||||
"reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4",
|
||||
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266",
|
||||
"reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1459,7 +1459,7 @@
|
||||
"logging",
|
||||
"psr-3"
|
||||
],
|
||||
"time": "2017-06-19T01:22:40+00:00"
|
||||
"time": "2018-11-05T09:00:11+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mtdowling/cron-expression",
|
||||
@ -2231,6 +2231,65 @@
|
||||
],
|
||||
"time": "2018-07-19T23:38:55+00:00"
|
||||
},
|
||||
{
|
||||
"name": "rap2hpoutre/laravel-log-viewer",
|
||||
"version": "v0.22.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/rap2hpoutre/laravel-log-viewer.git",
|
||||
"reference": "fd0821b073771f3e7256664417055a8bbb091059"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/rap2hpoutre/laravel-log-viewer/zipball/fd0821b073771f3e7256664417055a8bbb091059",
|
||||
"reference": "fd0821b073771f3e7256664417055a8bbb091059",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"illuminate/support": "4.2.*|5.*",
|
||||
"php": ">=5.4.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"orchestra/testbench": "^3.6",
|
||||
"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"
|
||||
],
|
||||
"time": "2018-10-01T09:01:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "spatie/laravel-activitylog",
|
||||
"version": "2.7.0",
|
||||
|
@ -135,7 +135,7 @@ return [
|
||||
|
|
||||
*/
|
||||
|
||||
'log' => env('APP_LOG', 'single'),
|
||||
'log' => env('APP_LOG', 'daily'), // by default logs for 5 days are kept
|
||||
|
||||
'log_level' => env('APP_LOG_LEVEL', 'error'),
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
<!-- CSRF Token -->
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
|
||||
<title>@if ($__env->yieldContent('title_full')) @yield('title_full') @elseif ($__env->yieldContent('title')) @yield('title') - {{ config('app.name', 'FreeScout') }} @else {{ config('app.name', 'FreeScout') }} @endif</title>
|
||||
<title>@if ($__env->yieldContent('title_full'))@yield('title_full') @elseif ($__env->yieldContent('title'))@yield('title') - {{ config('app.name', 'FreeScout') }} @else{{ config('app.name', 'FreeScout') }}@endif</title>
|
||||
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
|
||||
{{--<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
|
||||
|
234
resources/views/vendor/laravel-log-viewer/log.blade.php
vendored
Normal file
234
resources/views/vendor/laravel-log-viewer/log.blade.php
vendored
Normal file
@ -0,0 +1,234 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title', __('Logs'))
|
||||
|
||||
@section('sidebar')
|
||||
@include('partials/sidebar_menu_toggle')
|
||||
<div class="sidebar-title">
|
||||
{{ __('Logs') }}
|
||||
</div>
|
||||
@php
|
||||
$names = App\ActivityLog::select('log_name')->distinct()->pluck('log_name')->toArray();
|
||||
array_unshift($names, App\ActivityLog::NAME_OUT_EMAILS);
|
||||
array_push($names, App\ActivityLog::NAME_APP_LOGS);
|
||||
$current_name = 'app';
|
||||
@endphp
|
||||
<ul class="sidebar-menu">
|
||||
@foreach ($names as $name)
|
||||
<li @if ($current_name == $name)class="active"@endif><i class="glyphicon glyphicon-list-alt"></i> <a href="{{ route('logs', ['name'=>$name]) }}">{{ App\ActivityLog::getLogTitle($name) }}</a></li>
|
||||
@endforeach
|
||||
</ul>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
|
||||
<style>
|
||||
|
||||
|
||||
#table-log {
|
||||
font-size: inherit;
|
||||
}
|
||||
|
||||
#laravel-logs {
|
||||
padding: 0 15px 15px;
|
||||
}
|
||||
#laravel-logs .sidebar {
|
||||
/*font-size: 0.85rem;*/
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
#laravel-logs .btn {
|
||||
/*font-size: 0.7rem;*/
|
||||
}
|
||||
|
||||
#laravel-logs .stack {
|
||||
/*font-size: 0.85em;*/
|
||||
}
|
||||
|
||||
#laravel-logs .date {
|
||||
min-width: 75px;
|
||||
}
|
||||
|
||||
#laravel-logs .text {
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
#laravel-logs a.llv-active {
|
||||
z-index: 2;
|
||||
background-color: #f5f5f5;
|
||||
border-color: #777;
|
||||
}
|
||||
|
||||
#laravel-logs .list-group-item {
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
#laravel-logs .folder {
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
||||
#laravel-logs .div-scroll {
|
||||
/*height: 80vh;
|
||||
overflow: hidden auto;*/
|
||||
}
|
||||
#laravel-logs .nowrap {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="section-heading margin-bottom">
|
||||
{{ __('Log Records') }}
|
||||
</div>
|
||||
|
||||
<div class="container-fluid1" id="laravel-logs">
|
||||
<div class="row1">
|
||||
<div class="col sidebar mb-3">
|
||||
|
||||
<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>
|
||||
$(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>
|
||||
@endsection
|
||||
|
||||
@section('stylesheets')
|
||||
<link href="{{ asset('js/datatables/datatables.min.css') }}" rel="stylesheet">
|
||||
@endsection
|
||||
|
||||
@section('javascripts')
|
||||
<script src="{{ asset('js/datatables/datatables.min.js') }}"></script>
|
||||
@endsection
|
@ -24,6 +24,7 @@ Route::post('/user-setup/{hash}', 'PublicController@userSetupSave');
|
||||
|
||||
// General routes for logged in users
|
||||
Route::get('/', 'SecureController@dashboard')->name('dashboard');
|
||||
Route::get('/logs/app', ['uses' => '\Rap2hpoutre\LaravelLogViewer\LogViewerController@index', 'middleware' => ['auth', 'roles'], 'roles' => ['admin']])->name('logs.app');
|
||||
Route::get('/logs/{name?}', ['uses' => 'SecureController@logs', 'middleware' => ['auth', 'roles'], 'roles' => ['admin']])->name('logs');
|
||||
Route::post('/logs/{name?}', ['uses' => 'SecureController@logsSubmit', 'middleware' => ['auth', 'roles'], 'roles' => ['admin']]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user