Add waiting system application files
- Add main application files (main.py, models.py, schemas.py, etc.) - Add routers for all features (waiting, attendance, members, etc.) - Add HTML templates for admin and user interfaces - Add migration scripts and utility files - Add Docker configuration - Add documentation files - Add .gitignore to exclude database and cache files 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
240
templates/log_viewer.html
Normal file
240
templates/log_viewer.html
Normal file
@@ -0,0 +1,240 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ko">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>시스템 로그 분석기</title>
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
|
||||
<style>
|
||||
:root {
|
||||
--bg-color: #1e1e1e;
|
||||
--text-color: #d4d4d4;
|
||||
--panel-bg: #252526;
|
||||
--border-color: #3e3e42;
|
||||
--info-color: #3794ff;
|
||||
--error-color: #f14c4c;
|
||||
--warn-color: #cca700;
|
||||
--debug-color: #6a9955;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Consolas', 'Monaco', monospace;
|
||||
background-color: var(--bg-color);
|
||||
color: var(--text-color);
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
header {
|
||||
background-color: #333333;
|
||||
padding: 10px 20px;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
font-size: 18px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.controls {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
input,
|
||||
select,
|
||||
button {
|
||||
background-color: #3c3c3c;
|
||||
border: 1px solid var(--border-color);
|
||||
color: white;
|
||||
padding: 6px 12px;
|
||||
border-radius: 4px;
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
button {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #4c4c4c;
|
||||
}
|
||||
|
||||
button.primary {
|
||||
background-color: #0e639c;
|
||||
border-color: #0e639c;
|
||||
}
|
||||
|
||||
button.primary:hover {
|
||||
background-color: #1177bb;
|
||||
}
|
||||
|
||||
#log-container {
|
||||
flex: 1;
|
||||
overflow-y: auto;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.log-entry {
|
||||
display: flex;
|
||||
padding: 4px 8px;
|
||||
border-bottom: 1px solid #2d2d2d;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.log-entry:hover {
|
||||
background-color: #2a2d2e;
|
||||
}
|
||||
|
||||
.log-time {
|
||||
color: #858585;
|
||||
min-width: 160px;
|
||||
}
|
||||
|
||||
.log-level {
|
||||
min-width: 80px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.log-level.INFO {
|
||||
color: var(--info-color);
|
||||
}
|
||||
|
||||
.log-level.ERROR {
|
||||
color: var(--error-color);
|
||||
}
|
||||
|
||||
.log-level.WARNING {
|
||||
color: var(--warn-color);
|
||||
}
|
||||
|
||||
.log-level.DEBUG {
|
||||
color: var(--debug-color);
|
||||
}
|
||||
|
||||
.log-module {
|
||||
color: #c586c0;
|
||||
min-width: 150px;
|
||||
}
|
||||
|
||||
.log-message {
|
||||
flex: 1;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
.loading {
|
||||
text-align: center;
|
||||
padding: 20px;
|
||||
color: #858585;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header>
|
||||
<h1><i class="fas fa-terminal"></i> System Log Analyzer</h1>
|
||||
<div class="controls">
|
||||
<select id="levelFilter">
|
||||
<option value="">All Levels</option>
|
||||
<option value="INFO">INFO</option>
|
||||
<option value="WARNING">WARNING</option>
|
||||
<option value="ERROR">ERROR</option>
|
||||
<option value="DEBUG">DEBUG</option>
|
||||
</select>
|
||||
<input type="text" id="keywordFilter" placeholder="Search keyword..." style="width: 200px;">
|
||||
<button class="primary" onclick="loadLogs()">Refresh</button>
|
||||
<label style="display: flex; align-items: center; gap: 5px; font-size: 12px;">
|
||||
<input type="checkbox" id="autoRefresh"> Auto Poll (5s)
|
||||
</label>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div id="log-container">
|
||||
<!-- Logs will be injected here -->
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let autoRefreshInterval = null;
|
||||
|
||||
async function loadLogs() {
|
||||
const container = document.getElementById('log-container');
|
||||
const level = document.getElementById('levelFilter').value;
|
||||
const keyword = document.getElementById('keywordFilter').value;
|
||||
|
||||
// Only show loading if empty
|
||||
if (container.children.length === 0) {
|
||||
container.innerHTML = '<div class="loading">Loading logs...</div>';
|
||||
}
|
||||
|
||||
try {
|
||||
let url = `/logs/api?limit=200`;
|
||||
if (level) url += `&level=${level}`;
|
||||
if (keyword) url += `&keyword=${encodeURIComponent(keyword)}`;
|
||||
|
||||
const response = await fetch(url);
|
||||
const data = await response.json();
|
||||
|
||||
renderLogs(data.logs);
|
||||
} catch (error) {
|
||||
container.innerHTML = `<div class="loading" style="color:var(--error-color)">Error loading logs: ${error.message}</div>`;
|
||||
}
|
||||
}
|
||||
|
||||
function renderLogs(logs) {
|
||||
const container = document.getElementById('log-container');
|
||||
container.innerHTML = logs.map(log => {
|
||||
// Formatting timestamp
|
||||
const date = new Date(log.timestamp);
|
||||
const timeStr = date.toLocaleTimeString('ko-KR', { hour12: false }) + '.' + date.getMilliseconds().toString().padStart(3, '0');
|
||||
|
||||
return `
|
||||
<div class="log-entry">
|
||||
<div class="log-time" title="${log.timestamp}">${timeStr}</div>
|
||||
<div class="log-level ${log.level}">${log.level}</div>
|
||||
<div class="log-module">${log.module}:${log.line}</div>
|
||||
<div class="log-message">${escapeHtml(log.message)}</div>
|
||||
</div>
|
||||
`;
|
||||
}).join('');
|
||||
}
|
||||
|
||||
function escapeHtml(text) {
|
||||
if (!text) return '';
|
||||
return text
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
.replace(/>/g, ">")
|
||||
.replace(/"/g, """)
|
||||
.replace(/'/g, "'");
|
||||
}
|
||||
|
||||
// Auto Refresh Logic
|
||||
document.getElementById('autoRefresh').addEventListener('change', (e) => {
|
||||
if (e.target.checked) {
|
||||
loadLogs(); // Load immediately
|
||||
autoRefreshInterval = setInterval(loadLogs, 5000);
|
||||
} else {
|
||||
clearInterval(autoRefreshInterval);
|
||||
}
|
||||
});
|
||||
|
||||
// Trigger search on enter
|
||||
document.getElementById('keywordFilter').addEventListener('keypress', (e) => {
|
||||
if (e.key === 'Enter') loadLogs();
|
||||
});
|
||||
|
||||
// Initial Load
|
||||
loadLogs();
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user