- Integrated a logging service to redirect console outputs. - Added new endpoints for managing logs: - Retrieve log file list - Read specific log file content - Fetch recent logs - Stream logs via Server-Sent Events - Search logs by keyword - Cleanup old log files - Updated application metadata to include new log management features.
235 lines
8.5 KiB
HTML
235 lines
8.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh-CN">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>实时日志查看 - 代理IP管理系统</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css" rel="stylesheet">
|
|
<link href="css/dashboard.css" rel="stylesheet">
|
|
<style>
|
|
#logContainer {
|
|
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
|
|
font-size: 13px;
|
|
line-height: 1.6;
|
|
max-height: calc(100vh - 300px);
|
|
overflow-y: auto;
|
|
background: #1e1e1e;
|
|
color: #d4d4d4;
|
|
padding: 15px;
|
|
border-radius: 4px;
|
|
}
|
|
|
|
.log-entry {
|
|
margin-bottom: 4px;
|
|
padding: 2px 0;
|
|
word-wrap: break-word;
|
|
}
|
|
|
|
.log-timestamp {
|
|
color: #858585;
|
|
margin-right: 8px;
|
|
}
|
|
|
|
.log-level {
|
|
padding: 2px 6px;
|
|
border-radius: 3px;
|
|
font-size: 11px;
|
|
font-weight: bold;
|
|
margin-right: 8px;
|
|
}
|
|
|
|
.log-level.ERROR {
|
|
background: #f14c4c;
|
|
color: white;
|
|
}
|
|
|
|
.log-level.WARN {
|
|
background: #cca700;
|
|
color: white;
|
|
}
|
|
|
|
.log-level.INFO {
|
|
background: #007acc;
|
|
color: white;
|
|
}
|
|
|
|
.log-level.DEBUG {
|
|
background: #808080;
|
|
color: white;
|
|
}
|
|
|
|
.log-message {
|
|
color: #d4d4d4;
|
|
}
|
|
|
|
.log-entry.error .log-message {
|
|
color: #f48771;
|
|
}
|
|
|
|
.log-entry.warn .log-message {
|
|
color: #dcdcaa;
|
|
}
|
|
|
|
.log-entry.info .log-message {
|
|
color: #4ec9b0;
|
|
}
|
|
|
|
.log-entry.debug .log-message {
|
|
color: #808080;
|
|
}
|
|
|
|
.auto-scroll-indicator {
|
|
position: fixed;
|
|
bottom: 20px;
|
|
right: 20px;
|
|
background: rgba(0, 0, 0, 0.8);
|
|
color: white;
|
|
padding: 10px 15px;
|
|
border-radius: 20px;
|
|
font-size: 12px;
|
|
z-index: 1000;
|
|
display: none;
|
|
}
|
|
|
|
.auto-scroll-indicator.active {
|
|
display: block;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<!-- 导航栏 -->
|
|
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
|
|
<div class="container-fluid">
|
|
<a class="navbar-brand" href="index.html">
|
|
<i class="bi bi-shield-check"></i>
|
|
代理IP管理系统
|
|
</a>
|
|
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
|
|
<div class="collapse navbar-collapse" id="navbarNav">
|
|
<ul class="navbar-nav me-auto">
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="index.html">
|
|
<i class="bi bi-speedometer2"></i> 仪表板
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="proxies.html">
|
|
<i class="bi bi-list-ul"></i> 代理管理
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="history.html">
|
|
<i class="bi bi-clock-history"></i> 执行历史
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="monitoring.html">
|
|
<i class="bi bi-activity"></i> 系统监控
|
|
</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link active" href="logs.html">
|
|
<i class="bi bi-journal-text"></i> 实时日志
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
|
|
<div class="navbar-nav">
|
|
<div class="nav-link">
|
|
<span class="status-indicator" id="connectionStatus"></span>
|
|
<span id="connectionStatusText">连接中...</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<!-- 主要内容 -->
|
|
<div class="container-fluid mt-4">
|
|
<!-- 控制面板 -->
|
|
<div class="card mb-3">
|
|
<div class="card-body">
|
|
<div class="row align-items-center">
|
|
<div class="col-md-6">
|
|
<div class="btn-group" role="group">
|
|
<button type="button" class="btn btn-primary" id="startStreamBtn">
|
|
<i class="bi bi-play-fill"></i> 开始实时日志
|
|
</button>
|
|
<button type="button" class="btn btn-secondary" id="stopStreamBtn" disabled>
|
|
<i class="bi bi-stop-fill"></i> 停止
|
|
</button>
|
|
<button type="button" class="btn btn-outline-secondary" id="clearLogsBtn">
|
|
<i class="bi bi-x-circle"></i> 清空
|
|
</button>
|
|
</div>
|
|
<div class="form-check form-switch mt-2">
|
|
<input class="form-check-input" type="checkbox" id="autoScrollCheck" checked>
|
|
<label class="form-check-label" for="autoScrollCheck">
|
|
自动滚动
|
|
</label>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6 text-end">
|
|
<div class="input-group" style="max-width: 400px; margin-left: auto;">
|
|
<input type="text" class="form-control" id="searchKeyword" placeholder="搜索日志...">
|
|
<button class="btn btn-outline-secondary" type="button" id="searchBtn">
|
|
<i class="bi bi-search"></i> 搜索
|
|
</button>
|
|
</div>
|
|
<div class="mt-2">
|
|
<select class="form-select form-select-sm d-inline-block" id="logLevelFilter" style="width: auto;">
|
|
<option value="">所有级别</option>
|
|
<option value="ERROR">ERROR</option>
|
|
<option value="WARN">WARN</option>
|
|
<option value="INFO">INFO</option>
|
|
<option value="DEBUG">DEBUG</option>
|
|
</select>
|
|
<span class="ms-2 text-muted small">
|
|
日志数: <span id="logCount">0</span>
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 日志显示区域 -->
|
|
<div class="card">
|
|
<div class="card-header d-flex justify-content-between align-items-center">
|
|
<h6 class="mb-0">
|
|
<i class="bi bi-terminal"></i> 实时日志流
|
|
</h6>
|
|
<div>
|
|
<select class="form-select form-select-sm d-inline-block" id="logFileSelect" style="width: auto;">
|
|
<option value="">今日日志</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="card-body p-0">
|
|
<div id="logContainer"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 自动滚动指示器 -->
|
|
<div class="auto-scroll-indicator" id="autoScrollIndicator">
|
|
<i class="bi bi-arrow-down-circle"></i> 自动滚动中...
|
|
</div>
|
|
|
|
<!-- 提示消息容器 -->
|
|
<div class="position-fixed top-0 end-0 p-3" style="z-index: 1050">
|
|
<div id="alertContainer"></div>
|
|
</div>
|
|
|
|
<!-- JavaScript -->
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
<script src="js/logs.js"></script>
|
|
</body>
|
|
</html>
|
|
|