Update coverage reports and improve error handling

This commit is contained in:
2026-05-06 19:28:40 +02:00
parent 2968932d69
commit d57ade0ba8
22 changed files with 1851 additions and 1707 deletions
+9 -2
View File
@@ -27,7 +27,8 @@ const SEVERITY_ORDER = {
class Logger {
static setLevel(level) {
if (typeof level === 'string') {
Logger.minLevel = SEVERITY_ORDER[level.toLowerCase()] ?? LogLevel.DEBUG;
const lowerLevel = level.toLowerCase();
Logger.minLevel = SEVERITY_ORDER[lowerLevel] ?? LogLevel.DEBUG;
}
else {
Logger.minLevel = level;
@@ -35,21 +36,25 @@ class Logger {
}
static debug(message, category = 'general') {
if (LogLevel.DEBUG >= Logger.minLevel) {
// eslint-disable-next-line no-console
console.debug(`[${category}] DEBUG: ${message}`);
}
}
static info(message, category = 'general') {
if (LogLevel.INFO >= Logger.minLevel) {
// eslint-disable-next-line no-console
console.info(`[${category}] INFO: ${message}`);
}
}
static warn(message, category = 'general') {
if (LogLevel.WARN >= Logger.minLevel) {
// eslint-disable-next-line no-console
console.warn(`[${category}] WARN: ${message}`);
}
}
static error(message, category = 'general') {
if (LogLevel.ERROR >= Logger.minLevel) {
// eslint-disable-next-line no-console
console.error(`[${category}] ERROR: ${message}`);
}
}
@@ -164,9 +169,11 @@ function sanitizeFilePath(path) {
}
return path;
}
async function safeWriteFile(filePath, content) {
function safeWriteFile(filePath, content) {
const sanitizedPath = sanitizeFilePath(filePath);
// eslint-disable-next-line no-console
console.log(`Writing to ${sanitizedPath}:`, content);
return Promise.resolve();
}
// ==================== HTTP Helpers ====================
function isValidHttpUrl(url) {