Pratham200Rajbhar
first commit
78013c4
Raw
History Blame Contribute Delete
743 Bytes
type LogLevel = 'debug' | 'info' | 'warn' | 'error';
const PREFIX: Record<LogLevel, string> = {
debug: '⚫',
info: '🔵',
warn: '🟡',
error: '🔴',
};
export const logger = {
debug(message: string, ...args: unknown[]) {
if (process.env.NODE_ENV === 'development') {
console.debug(`${PREFIX.debug} ${message}`, ...args);
}
},
info(message: string, ...args: unknown[]) {
if (process.env.NODE_ENV === 'development') {
console.info(`${PREFIX.info} ${message}`, ...args);
}
},
warn(message: string, ...args: unknown[]) {
console.warn(`${PREFIX.warn} ${message}`, ...args);
},
error(message: string, ...args: unknown[]) {
console.error(`${PREFIX.error} ${message}`, ...args);
},
};