pm2 live logs
This commit is contained in:
1 parent
0b9be294c2
commit
ec38d0245a
4 files changed
+69
-4
No files matched your search
@@ -127,10 +127,27 @@
|
||||
|
||||
</div>
|
||||
|
||||
<!-- ======================= -->
|
||||
<!-- PM2 LOGS -->
|
||||
<!-- ======================= -->
|
||||
<div class="row mt-4">
|
||||
<div class="col-12">
|
||||
<pre id="pm2Logs" style="background:#383838; padding:10px; border-radius:5px; height:300px; overflow-y:auto; white-space:pre-wrap; color: #330000;"></pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- ======================= -->
|
||||
<!-- AUTO-REFRESH SCRIPT -->
|
||||
<!-- ======================= -->
|
||||
<script>
|
||||
const logBox = document.getElementById("pm2Logs");
|
||||
const ws = new WebSocket("ws://" + window.location.host);
|
||||
ws.onmessage = event => {
|
||||
logBox.textContent += event.data + "\n";
|
||||
logBox.scrollTop = logBox.scrollHeight;
|
||||
};
|
||||
|
||||
function formatBytes(bytes) {
|
||||
if (!bytes) return "Unknown";
|
||||
const units = ["B","KB","MB","GB","TB"];
|
||||
|
||||
Reference in new issue
Block a user