| class Logger { | |
| constructor(context) { | |
| this.context = context; | |
| } | |
| getTimestamp() { | |
| return new Date().toISOString().replace("T", " ").substring(0, 19); | |
| } | |
| info(message, ...args) { | |
| console.log(`[INFO] [${this.getTimestamp()}] [${this.context}] | ${message}`, ...args); | |
| } | |
| warn(message, ...args) { | |
| console.log(`[WARN] [${this.getTimestamp()}] [${this.context}] | ${message}`, ...args); | |
| } | |
| error(message, ...args) { | |
| console.log(`[ERROR] [${this.getTimestamp()}] [${this.context}] | ${message}`, ...args); | |
| } | |
| success(message, ...args) { | |
| console.log(`[SUCCESS] [${this.getTimestamp()}] [${this.context}] | ${message}`, ...args); | |
| } | |
| debug(message, ...args) { | |
| if (process.env.NODE_ENV === "development") { | |
| console.log(`[DEBUG] [${this.getTimestamp()}] [${this.context}] | ${message}`, ...args); | |
| } | |
| } | |
| } | |
| module.exports = { Logger }; |