fix: KoePi Konsolen-Log Zeitzone korrigiert, sicherstellen dass Start-Hook aktiv ist

This commit is contained in:
2026-07-18 17:35:47 +02:00
parent b07a87ac45
commit 8ff1fd630b

View File

@@ -14,10 +14,16 @@ function stringifyArg(a) {
try { return JSON.stringify(a); } catch { return String(a); }
}
function localTimestamp() {
const d = new Date();
const pad = (n, len=2) => String(n).padStart(len, '0');
return `${d.getFullYear()}-${pad(d.getMonth()+1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}.${pad(d.getMilliseconds(),3)}`;
}
function appendLine(level, args) {
try {
const msg = args.map(stringifyArg).join(' ');
fs.appendFileSync(LOG_FILE, `[${new Date().toISOString()}] [${level}] ${msg}\n`);
fs.appendFileSync(LOG_FILE, `[${localTimestamp()}] [${level}] ${msg}\n`);
} catch {
// Darf niemals die eigentliche Konsolen-Ausgabe verhindern
}
@@ -34,7 +40,7 @@ function pruneOldLines() {
const lines = content.split('\n').filter(line => {
const m = line.match(/^\[([^\]]+)\]/);
if (!m) return true;
const t = new Date(m[1]).getTime();
const t = new Date(m[1].replace(' ', 'T')).getTime();
return Number.isNaN(t) || t >= cutoff;
});
fs.writeFileSync(LOG_FILE, lines.join('\n'));