first commit

This commit is contained in:
2026-08-09 16:53:38 +03:00
commit e92e0df644
28 changed files with 1143 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
import { config } from '../config.js';
const LEVELS = { debug: 10, info: 20, warn: 30, error: 40 };
const threshold = LEVELS[config.logLevel] ?? LEVELS.info;
const write = (level, stream, args) => {
if (LEVELS[level] < threshold) return;
stream(`[${new Date().toISOString()}] ${level.toUpperCase()}`, ...args);
};
export const logger = {
debug: (...args) => write('debug', console.debug, args),
info: (...args) => write('info', console.info, args),
warn: (...args) => write('warn', console.warn, args),
error: (...args) => write('error', console.error, args),
};