/**
* Simple logger utility
* Wrapper around console with log levels
*/
/**
* Logger object with different log levels
*/
export const logger = {
/**
* Log debug message (only if LOG_LEVEL=debug)
*/
debug: (msg: string, ctx?: Record<string, unknown>): void => {
if (process.env.LOG_LEVEL === 'debug') {
console.log(`[DEBUG] ${msg}`, ctx || '');
}
},
/**
* Log info message
*/
info: (msg: string, ctx?: Record<string, unknown>): void => {
console.log(`[INFO] ${msg}`, ctx || '');
},
/**
* Log warning message
*/
warn: (msg: string, ctx?: Record<string, unknown>): void => {
console.warn(`[WARN] ${msg}`, ctx || '');
},
/**
* Log error message
*/
error: (msg: string, err?: Error, ctx?: Record<string, unknown>): void => {
console.error(`[ERROR] ${msg}`, err || '', ctx || '');
},
};