qcast-front/src/util/logger.js

30 lines
707 B
JavaScript

// utils/logger.js
const isLoggingEnabled = process.env.NEXT_PUBLIC_ENABLE_LOGGING;
export const logger = {
log: (...args) => {
if (isLoggingEnabled) {
console.log(...args);
}
},
error: (...args) => {
// 에러는 항상 로깅하거나, 또는 환경에 따라 다르게 처리
console.error(...args);
// 운영 환경에서는 서버로 에러를 보내는 코드를 추가할 수도 있음
},
warn: (...args) => {
if (isLoggingEnabled) {
console.warn(...args);
}
},
info: (...args) => {
if (isLoggingEnabled) {
console.info(...args);
}
},
debug: (...args) => {
if (isLoggingEnabled) {
console.debug(...args);
}
}
};