UNPKG

rebootify

Version:

A Faster and lightweight alertnative to nodemon to monitor your Node Application

19 lines (14 loc) 587 B
const chalk = require('chalk'); // CommonJS syntax for Chalk v5 const logLevels = { info: chalk.blue, debug: chalk.green, error: chalk.red.bold }; // Use chalk.hex() for gray color in Chalk v5 const logger = (level, message) => { const logFunction = logLevels[level] || chalk.white; const timestamp = new Date().toISOString(); // Using chalk.hex('#808080') for gray console.log(`[${chalk.hex('#808080')(timestamp)}] ${logFunction(`[${level.toUpperCase()}]`)} ${message}`); }; module.exports = logger; // CommonJS export for older versions of Node.js