From 274b8034bdeff50dc49796bee89cd2dc016916bb Mon Sep 17 00:00:00 2001 From: hermes Date: Fri, 10 Jul 2026 02:57:24 +0200 Subject: [PATCH] feat: timestamps in logs, suppress favicon.ico --- server.mjs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server.mjs b/server.mjs index c26782d..a7aa890 100644 --- a/server.mjs +++ b/server.mjs @@ -61,12 +61,15 @@ function writeLog(msg) { function readLogBuffer(n) { return logBuffer.slice(-n).join(''); } -// Override stderr.write to also capture to our buffer +// Override stderr.write to add timestamps and capture to buffer const origStdErrWrite = process.stderr.write.bind(process.stderr); process.stderr.write = (chunk, ...args) => { - logBuffer.push(String(chunk)); + const ts = new Date().toISOString().replace('T', ' ').replace(/\.\d+Z$/, ''); + const line = String(chunk); + const tsLine = line.split('\n').filter(l => l).map(l => `[${ts}] ${l}`).join('\n') + '\n'; + logBuffer.push(tsLine); if (logBuffer.length > LOG_MAX) logBuffer.shift(); - return origStdErrWrite(chunk, ...args); + return origStdErrWrite(tsLine, ...args); }; // ---------- Models that support transparent background ----------