dev logging 설정 logger.log('a', a) #146
@ -30,3 +30,6 @@ AWS_SECRET_ACCESS_KEY="Cw87TjKwnTWRKgORGxYiFU6GUTgu25eUw4eLBNcA"
|
|||||||
NEXT_PUBLIC_AWS_S3_BASE_URL="//files.hanasys.jp"
|
NEXT_PUBLIC_AWS_S3_BASE_URL="//files.hanasys.jp"
|
||||||
|
|
||||||
S3_PROFILE="dev"
|
S3_PROFILE="dev"
|
||||||
|
|
||||||
|
#logging
|
||||||
|
NEXT_PUBLIC_ENABLE_LOGGING=true
|
||||||
@ -31,3 +31,6 @@ AWS_SECRET_ACCESS_KEY="Cw87TjKwnTWRKgORGxYiFU6GUTgu25eUw4eLBNcA"
|
|||||||
NEXT_PUBLIC_AWS_S3_BASE_URL="//files.hanasys.jp"
|
NEXT_PUBLIC_AWS_S3_BASE_URL="//files.hanasys.jp"
|
||||||
|
|
||||||
S3_PROFILE="prd"
|
S3_PROFILE="prd"
|
||||||
|
|
||||||
|
#logging
|
||||||
|
NEXT_PUBLIC_ENABLE_LOGGING=false
|
||||||
30
src/util/logger.js
Normal file
30
src/util/logger.js
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// utils/logger.js
|
||||||
|
const isLoggingEnabled = process.env.NEXT_PUBLIC_ENABLE_LOGGING === 'true';
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
Loading…
x
Reference in New Issue
Block a user