This commit is contained in:
seb
2026-10-08 03:43:28 +02:00
parent c543c76a21
commit 717f4754d4
9 changed files with 787 additions and 24 deletions

View File

@@ -2,6 +2,9 @@ import { appendFileSync, mkdirSync } from 'fs';
import { dirname, resolve } from 'path';
import { fileURLToPath } from 'url';
import { prettyJson } from '../util/prettyJson.js';
import { createLogger } from '../util/logger.js';
const log = createLogger('error-log');
const __dirname = dirname(fileURLToPath(import.meta.url));
const LOG_DIR = process.env.ERROR_LOG_DIR || resolve(__dirname, '../../logs/errors');
@@ -46,10 +49,10 @@ export function writeErrorLog(label, sections) {
}
appendFileSync(filePath, `${parts.join('\n')}\n`);
console.error(`[error-log] Wrote ${filePath}`);
log.info(`Wrote ${filePath}`);
return filePath;
} catch (err) {
console.error('[error-log] Failed to write error log:', err.message);
log.error('Failed to write error log:', err.message);
return null;
}
}