modified: app.py

modified:   requirements.txt
	new file:   templates/logs.html
This commit is contained in:
SimolZimol
2024-09-03 12:46:00 +02:00
parent e3663ca141
commit f2b9d58af3
3 changed files with 78 additions and 2 deletions

38
templates/logs.html Normal file
View File

@@ -0,0 +1,38 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Bot Logs</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.1.3/socket.io.min.js"></script>
</head>
<body>
<div class="container mt-5">
<h1 class="text-center">Bot Logs</h1>
<div class="mt-4">
<h3>Live Logs</h3>
<pre id="live-logs" class="bg-dark text-light p-3" style="height: 300px; overflow-y: scroll;"></pre>
</div>
<div class="mt-4">
<h3>Log Files</h3>
<ul class="list-group">
{% for log_file in log_files %}
<li class="list-group-item">
<a href="{{ url_for('view_log', log_file=log_file) }}">{{ log_file }}</a>
</li>
{% endfor %}
</ul>
</div>
<a href="{{ url_for('index') }}" class="btn btn-secondary btn-block mt-3">Back to Dashboard</a>
</div>
<script>
var socket = io();
socket.on('log', function(msg) {
var logs = document.getElementById('live-logs');
logs.innerHTML += msg.data + '\n';
logs.scrollTop = logs.scrollHeight;
});
</script>
</body>
</html>