c
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user