483 lines
15 KiB
PHP
483 lines
15 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title><?= esc($title) ?></title>
|
|
<style>
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
/* body {
|
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
min-height: 100vh;
|
|
padding: 20px;
|
|
} */
|
|
|
|
.container {
|
|
max-width: 1400px;
|
|
margin: 0 auto;
|
|
background: white;
|
|
border-radius: 10px;
|
|
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
|
|
overflow: hidden;
|
|
}
|
|
|
|
.header {
|
|
/* background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); */
|
|
color: black;
|
|
padding: 5px;
|
|
}
|
|
|
|
.header h1 {
|
|
font-size: 1.8rem;
|
|
margin-bottom: 10px;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
}
|
|
|
|
|
|
|
|
.file-info {
|
|
display: flex;
|
|
gap: 30px;
|
|
margin-top: 15px;
|
|
opacity: 0.9;
|
|
}
|
|
|
|
.file-info-item {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
}
|
|
|
|
.content {
|
|
padding: 30px;
|
|
}
|
|
|
|
.controls {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 20px;
|
|
padding: 15px;
|
|
background: #f8f9fa;
|
|
border-radius: 8px;
|
|
flex-wrap: wrap;
|
|
gap: 15px;
|
|
}
|
|
|
|
.filter-group {
|
|
display: flex;
|
|
gap: 10px;
|
|
align-items: center;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
.filter-btn {
|
|
padding: 8px 16px;
|
|
border: 2px solid #dee2e6;
|
|
background: white;
|
|
border-radius: 5px;
|
|
cursor: pointer;
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
.filter-btn:hover {
|
|
border-color: #667eea;
|
|
color: #667eea;
|
|
}
|
|
|
|
.filter-btn.active {
|
|
background: #667eea;
|
|
color: white;
|
|
border-color: #667eea;
|
|
}
|
|
|
|
.search-box {
|
|
padding: 10px 15px;
|
|
border: 2px solid #dee2e6;
|
|
border-radius: 5px;
|
|
font-size: 14px;
|
|
width: 300px;
|
|
transition: border-color 0.3s ease;
|
|
}
|
|
|
|
.search-box:focus {
|
|
outline: none;
|
|
border-color: #667eea;
|
|
}
|
|
|
|
.log-entries {
|
|
background: #f8f9fa;
|
|
border-radius: 8px;
|
|
padding: 20px;
|
|
max-height: 600px;
|
|
overflow-y: auto;
|
|
}
|
|
|
|
.log-entry {
|
|
background: white;
|
|
border-left: 4px solid #6c757d;
|
|
padding: 15px;
|
|
margin-bottom: 15px;
|
|
border-radius: 5px;
|
|
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
|
|
transition: all 0.3s ease;
|
|
}
|
|
|
|
.log-entry:hover {
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
transform: translateX(5px);
|
|
}
|
|
|
|
.log-entry.critical {
|
|
border-left-color: #dc3545;
|
|
background: #fff5f5;
|
|
}
|
|
|
|
.log-entry.error {
|
|
border-left-color: #fd7e14;
|
|
background: #fff8f5;
|
|
}
|
|
|
|
.log-entry.warning {
|
|
border-left-color: #ffc107;
|
|
background: #fffef5;
|
|
}
|
|
|
|
.log-entry.info {
|
|
border-left-color: #17a2b8;
|
|
background: #f5fcfd;
|
|
}
|
|
|
|
.log-entry.debug {
|
|
border-left-color: #6c757d;
|
|
background: #f8f9fa;
|
|
}
|
|
|
|
.log-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 10px;
|
|
padding-bottom: 10px;
|
|
border-bottom: 1px solid #e9ecef;
|
|
}
|
|
|
|
.log-level {
|
|
padding: 4px 12px;
|
|
border-radius: 20px;
|
|
font-size: 12px;
|
|
font-weight: 700;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
}
|
|
|
|
.level-critical {
|
|
background: #dc3545;
|
|
color: white;
|
|
}
|
|
|
|
.level-error {
|
|
background: #fd7e14;
|
|
color: white;
|
|
}
|
|
|
|
.level-warning {
|
|
background: #ffc107;
|
|
color: #333;
|
|
}
|
|
|
|
.level-info {
|
|
background: #17a2b8;
|
|
color: white;
|
|
}
|
|
|
|
.level-debug {
|
|
background: #6c757d;
|
|
color: white;
|
|
}
|
|
|
|
.log-date {
|
|
color: #6c757d;
|
|
font-size: 13px;
|
|
font-family: 'Courier New', monospace;
|
|
}
|
|
|
|
.log-message {
|
|
color: #333;
|
|
line-height: 1.6;
|
|
font-size: 14px;
|
|
white-space: pre-wrap;
|
|
word-wrap: break-word;
|
|
font-family: 'Courier New', monospace;
|
|
}
|
|
|
|
.no-logs {
|
|
text-align: center;
|
|
padding: 60px 20px;
|
|
color: #6c757d;
|
|
}
|
|
|
|
.stats {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
|
|
gap: 15px;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.stat-card {
|
|
background-color: #fff;
|
|
color: #333;
|
|
padding: 0px;
|
|
border: 1px solid #007bff;
|
|
border-radius: 5px;
|
|
text-align: center;
|
|
border-width: 1px;
|
|
transition: all 0.3s ease;
|
|
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
|
|
|
|
.stat-card:hover {
|
|
transform: translateY(-5px);
|
|
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
|
|
border-color: #0056b3;
|
|
}
|
|
|
|
.stat-card h3 {
|
|
font-size: 2rem;
|
|
margin-bottom: 5px;
|
|
}
|
|
|
|
.stat-card p {
|
|
opacity: 0.9;
|
|
font-size: 15px;
|
|
}
|
|
|
|
.hidden {
|
|
display: none;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.search-box {
|
|
width: 100%;
|
|
}
|
|
|
|
.controls {
|
|
flex-direction: column;
|
|
align-items: stretch;
|
|
}
|
|
|
|
.filter-group {
|
|
justify-content: center;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<div class="header">
|
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
|
<h1>
|
|
📄 <?= esc($filename) ?>
|
|
</h1>
|
|
|
|
<div style="display:flex; gap:10px; margin-bottom:15px;">
|
|
<?php if ($prevFile): ?>
|
|
<a href="<?= base_url('logs/view/' . $prevFile) ?>" class="btn btn-primary">Previous</a>
|
|
<?php else: ?>
|
|
<button class="btn btn-secondary" disabled>⬅ Previous Day</button>
|
|
<?php endif; ?>
|
|
|
|
<?php if ($nextFile): ?>
|
|
<a href="<?= base_url('logs/view/' . $nextFile) ?>" class="btn btn-primary">Next</a>
|
|
<?php else: ?>
|
|
<button class="btn btn-secondary" disabled>Next Day ➡</button>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<!-- <div class="file-info">
|
|
<div class="file-info-item">
|
|
<strong>Size:</strong> <?= esc($fileSize) ?>
|
|
</div>
|
|
<div class="file-info-item">
|
|
<strong>Last Modified:</strong> <?= esc($lastModified) ?>
|
|
</div>
|
|
<div class="file-info-item">
|
|
<strong>Total Entries:</strong> <?= count($logEntries) ?>
|
|
</div>
|
|
</div> -->
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="content">
|
|
<div class="stats">
|
|
|
|
|
|
|
|
<!--<div class="stat-card">
|
|
<h3 id="total-count"><?= count($logEntries) ?></h3>
|
|
<p>Total Entries</p>
|
|
</div>
|
|
<div class="stat-card">
|
|
<h3 id="critical-count">
|
|
<?= count(array_filter($logEntries, fn($e) => strtoupper($e['level']) === 'CRITICAL')) ?>
|
|
</h3>
|
|
<p>Critical</p>
|
|
</div>
|
|
<div class="stat-card">
|
|
<h3 id="error-count">
|
|
<?= count(array_filter($logEntries, fn($e) => strtoupper($e['level']) === 'ERROR')) ?>
|
|
</h3>
|
|
<p>Errors</p>
|
|
</div>
|
|
<div class="stat-card">
|
|
<h3 id="warning-count">
|
|
<?= count(array_filter($logEntries, fn($e) => strtoupper($e['level']) === 'WARNING')) ?>
|
|
</h3>
|
|
<p>Warnings</p>
|
|
</div> -->
|
|
|
|
|
|
|
|
<div class="stat-card">
|
|
<h3 id="newtoken-count">
|
|
<?= count(array_filter($logEntries, fn($e) => stripos($e['message'], 'TPA CLAIM PUSH SUCCESS') !== false)) ?>
|
|
</h3>
|
|
<p>Claim success</p>
|
|
</div>
|
|
<div class="stat-card">
|
|
<h3 id="newtoken-count">
|
|
<?= count(array_filter($logEntries, fn($e) => stripos($e['message'], 'TPA CLAIM PUSH FAILED') !== false)) ?>
|
|
</h3>
|
|
<p>Claim failed</p>
|
|
</div>
|
|
<div class="stat-card">
|
|
<h3 id="newtoken-count">
|
|
<?= count(array_filter($logEntries, fn($e) => stripos($e['message'], 'TPA ID PULL SUCCESS') !== false)) ?>
|
|
</h3>
|
|
<p>Tpa no pull success</p>
|
|
</div>
|
|
<div class="stat-card">
|
|
<h3 id="newtoken-count">
|
|
<?= count(array_filter($logEntries, fn($e) => stripos($e['message'], 'TPA ID PULL FAILED') !== false)) ?>
|
|
</h3>
|
|
<p>Tpa no pull Failed</p>
|
|
</div>
|
|
<div class="stat-card">
|
|
<h3 id="newtoken-count">
|
|
<?= count(array_filter($logEntries, fn($e) => stripos($e['message'], 'CLAIM STATUS SUCCESS') !== false)) ?>
|
|
</h3>
|
|
<p>Claim status fetch success</p>
|
|
</div>
|
|
<div class="stat-card">
|
|
<h3 id="newtoken-count">
|
|
<?= count(array_filter($logEntries, fn($e) => stripos($e['message'], 'CLAIM STATUS FAILED') !== false)) ?>
|
|
</h3>
|
|
<p>Claim status fetch failed</p>
|
|
</div>
|
|
<div class="stat-card">
|
|
<h3 id="newtoken-count">
|
|
<?= count(array_filter($logEntries, fn($e) => stripos($e['message'], 'Ecard Request PUSH SUCCESS') !== false)) ?>
|
|
</h3>
|
|
<p>Ecard Request</p>
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<div class="controls">
|
|
<div class="filter-group">
|
|
<strong>Filter:</strong>
|
|
<button class="filter-btn active" data-level="all">All</button>
|
|
<button class="filter-btn" data-level="critical">Critical</button>
|
|
<button class="filter-btn" data-level="error">Error</button>
|
|
<button class="filter-btn" data-level="warning">Warning</button>
|
|
<button class="filter-btn" data-level="info">Info</button>
|
|
<button class="filter-btn" data-level="debug">Debug</button>
|
|
</div>
|
|
<input type="text" class="search-box" id="searchBox" placeholder="🔍 Search log messages...">
|
|
</div>
|
|
|
|
<?php if (empty($logEntries)): ?>
|
|
<div class="no-logs">
|
|
<h3>No Log Entries Found</h3>
|
|
<p>This log file is empty or couldn't be parsed.</p>
|
|
</div>
|
|
<?php else: ?>
|
|
<div class="log-entries" id="logEntries">
|
|
<?php foreach ($logEntries as $entry): ?>
|
|
<?php
|
|
$level = strtolower($entry['level']);
|
|
$levelClass = 'level-' . $level;
|
|
?>
|
|
<div class="log-entry <?= $level ?>" data-level="<?= $level ?>">
|
|
<div class="log-header">
|
|
<span class="log-level <?= $levelClass ?>">
|
|
<?= esc(strtoupper($entry['level'])) ?>
|
|
</span>
|
|
<span class="log-date"><?= esc($entry['date']) ?></span>
|
|
</div>
|
|
<div class="log-message"><?= esc($entry['message']) ?></div>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
// Filter functionality
|
|
const filterBtns = document.querySelectorAll('.filter-btn');
|
|
const logEntries = document.querySelectorAll('.log-entry');
|
|
const searchBox = document.getElementById('searchBox');
|
|
|
|
let currentFilter = 'all';
|
|
|
|
filterBtns.forEach(btn => {
|
|
btn.addEventListener('click', () => {
|
|
filterBtns.forEach(b => b.classList.remove('active'));
|
|
btn.classList.add('active');
|
|
currentFilter = btn.dataset.level;
|
|
applyFilters();
|
|
});
|
|
});
|
|
|
|
searchBox.addEventListener('input', applyFilters);
|
|
|
|
function applyFilters() {
|
|
const searchTerm = searchBox.value.toLowerCase();
|
|
|
|
logEntries.forEach(entry => {
|
|
const level = entry.dataset.level;
|
|
const message = entry.querySelector('.log-message').textContent.toLowerCase();
|
|
|
|
const matchesFilter = currentFilter === 'all' || level === currentFilter;
|
|
const matchesSearch = message.includes(searchTerm);
|
|
|
|
if (matchesFilter && matchesSearch) {
|
|
entry.classList.remove('hidden');
|
|
} else {
|
|
entry.classList.add('hidden');
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|