chore: stabilize monorepo build and typescript setup

This commit is contained in:
2026-07-20 21:54:36 +02:00
parent 5fd48d1971
commit 4855bb882c
30 changed files with 1536 additions and 405 deletions
+47
View File
@@ -0,0 +1,47 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getLogger = getLogger;
const LEVELS = {
DEBUG: 0,
INFO: 1,
WARN: 2,
ERROR: 3,
};
const DEFAULT_LOG_LEVEL = "INFO";
const configuredLevel = (process.env.LOG_LEVEL ?? "").toUpperCase();
const currentLogLevel = configuredLevel in LEVELS ? configuredLevel : DEFAULT_LOG_LEVEL;
const currentLogLevelValue = LEVELS[currentLogLevel];
function shouldLog(level) {
return LEVELS[level] >= currentLogLevelValue;
}
function formatMessage(level, component, message) {
return `${new Date().toISOString()} ${level} [${component}] ${message}`;
}
class Logger {
constructor(component) {
this.component = component;
}
debug(message, ...args) {
if (!shouldLog("DEBUG"))
return;
console.log(formatMessage("DEBUG", this.component, message), ...args);
}
info(message, ...args) {
if (!shouldLog("INFO"))
return;
console.log(formatMessage("INFO", this.component, message), ...args);
}
warn(message, ...args) {
if (!shouldLog("WARN"))
return;
console.warn(formatMessage("WARN", this.component, message), ...args);
}
error(message, ...args) {
if (!shouldLog("ERROR"))
return;
console.error(formatMessage("ERROR", this.component, message), ...args);
}
}
function getLogger(component) {
return new Logger(component);
}