You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
3.2 KiB

{% extends "base.html" %}
{% block title %}日志管理 - 邮件系统{% endblock %}
{% block content %}
<div class="main-layout">
<div class="sidebar">
<a href="{{ url_for('admin_dashboard') }}">📊 仪表盘</a>
<a href="{{ url_for('admin_users') }}">👥 用户管理</a>
<a href="{{ url_for('admin_services') }}">⚙️ 服务管理</a>
<a href="{{ url_for('admin_settings') }}">🔧 系统设置</a>
<a href="{{ url_for('admin_filters') }}">🛡️ 过滤规则</a>
<a href="{{ url_for('admin_logs') }}" class="active">📋 日志管理</a>
<a href="{{ url_for('admin_broadcast') }}">📢 群发邮件</a>
<hr style="margin: 1rem 0;">
<a href="{{ url_for('inbox') }}">← 返回邮箱</a>
</div>
<div class="main-content">
<div class="card">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem;">
<h2>系统日志</h2>
<a href="{{ url_for('admin_clear_logs') }}" class="btn btn-danger"
onclick="return confirm('确定清空所有日志?')">清空日志</a>
</div>
<table>
<thead>
<tr>
<th>时间</th>
<th>级别</th>
<th>来源</th>
<th>IP</th>
<th>消息</th>
</tr>
</thead>
<tbody>
{% for log in logs.items %}
<tr>
<td style="white-space: nowrap;">{{ log.created_at.strftime('%Y-%m-%d %H:%M:%S') }}</td>
<td><span
class="badge {% if log.level == 'ERROR' %}badge-danger{% elif log.level == 'WARNING' %}badge-warning{% else %}badge-success{% endif %}">{{
log.level }}</span></td>
<td>{{ log.source or '-' }}</td>
<td>{{ log.ip_address or '-' }}</td>
<td>{{ log.message }}</td>
</tr>
{% else %}
<tr>
<td colspan="5" style="text-align: center; color: #6b7280;">暂无日志</td>
</tr>
{% endfor %}
</tbody>
</table>
{% if logs.pages > 1 %}
<div class="pagination">
{% if logs.has_prev %}
<a href="{{ url_for('admin_logs', page=logs.prev_num) }}">上一页</a>
{% endif %}
{% for p in logs.iter_pages() %}
{% if p %}
<a href="{{ url_for('admin_logs', page=p) }}" {% if p==logs.page %}class="active" {% endif %}>{{ p
}}</a>
{% else %}
<span>...</span>
{% endif %}
{% endfor %}
{% if logs.has_next %}
<a href="{{ url_for('admin_logs', page=logs.next_num) }}">下一页</a>
{% endif %}
</div>
{% endif %}
</div>
</div>
</div>
{% endblock %}