This commit is contained in:
14
log.js
Normal file
14
log.js
Normal file
@ -0,0 +1,14 @@
|
||||
// logger.js
|
||||
function log(level, message, ...args) {
|
||||
const now = new Date().toISOString();
|
||||
const levelLabel = `[${level.toUpperCase()}]`.padEnd(8);
|
||||
|
||||
log.info(`${now} ${levelLabel} ${message}`, ...args);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
info: (msg, ...args) => log("info", msg, ...args),
|
||||
warn: (msg, ...args) => log("warn", msg, ...args),
|
||||
error: (msg, ...args) => log("error", msg, ...args),
|
||||
debug: (msg, ...args) => log("debug", msg, ...args),
|
||||
};
|
Reference in New Issue
Block a user