feat: timestamps in logs, suppress favicon.ico

This commit is contained in:
hermes committed 2026-07-10 02:57:24 +02:00
1 parent 8243b3097d
commit 274b8034bd
1 file changed
+6 -3
+6 -3
View File
@@ -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 ----------