UNPKG

@upv/ushi-shared

Version:

Shared DTOs, types, and utilities for the USHI platform (LMS, Trials, Social, Wallet).

35 lines (34 loc) 921 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.logger = void 0; // Disable logging if LOG=none const noLog = process.env.LOG === 'none'; const log = (level, message, context) => { if (noLog) return; const entry = { level, timestamp: new Date().toISOString(), message, ...(context && { context }), }; const output = JSON.stringify(entry); switch (level) { case 'debug': case 'info': console.log(output); break; case 'warn': console.warn(output); break; case 'error': console.error(output); break; } }; exports.logger = { debug: (msg, ctx) => log('debug', msg, ctx), info: (msg, ctx) => log('info', msg, ctx), warn: (msg, ctx) => log('warn', msg, ctx), error: (msg, ctx) => log('error', msg, ctx), };