mirror of
https://github.com/vladmandic/automatic
synced 2026-09-18 16:54:33 +02:00
@@ -43,10 +43,10 @@ function joinArgs(messages) {
|
||||
async function monitorLog() {
|
||||
if (window.logBufferDirty) {
|
||||
window.logBufferDirty = false;
|
||||
const maxLines = 5; // print last n logs from ring buffer to splash-log
|
||||
const maxLines = 100; // print last n logs from ring buffer to splash-log
|
||||
const lines = [];
|
||||
// print last 5 logs from ring buffer in reverse order
|
||||
for (let i = window.logRingBuffer.length - 1; i >= Math.max(0, window.logRingBuffer.length - maxLines); i--) {
|
||||
// print last n logs from ring buffer in time order
|
||||
for (let i = Math.max(0, window.logRingBuffer.length - maxLines); i < window.logRingBuffer.length; i++) {
|
||||
const logEntry = window.logRingBuffer[i];
|
||||
let color = 'white';
|
||||
if (logEntry.type === 'error') color = 'palevioletred';
|
||||
@@ -57,7 +57,7 @@ async function monitorLog() {
|
||||
const splashLogEl = document.getElementById('splashLog');
|
||||
if (splashLogEl) splashLogEl.innerHTML = lines.join('');
|
||||
}
|
||||
if (monitorLogActive) setTimeout(monitorLog, 1000);
|
||||
if (monitorLogActive) setTimeout(monitorLog, 250);
|
||||
}
|
||||
|
||||
async function removeSplash() {
|
||||
|
||||
@@ -2,8 +2,9 @@ window.logRingBuffer = [];
|
||||
window.logBufferDirty = false;
|
||||
|
||||
const logBuffer = (ts, type, msg) => {
|
||||
const maxLogLength = 8;
|
||||
window.logRingBuffer.push({ ts, type, msg });
|
||||
if (window.logRingBuffer.length > 10) window.logRingBuffer.shift();
|
||||
if (window.logRingBuffer.length > maxLogLength) window.logRingBuffer.shift();
|
||||
window.logBufferDirty = true;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user