mnglab
Version:
Dead simple REST micro-framework with modular routing, API key, rate limiting, full HTTP response handling, dev tools, JSON DB, file helpers, endpoint stats, and professional developer experience.
34 lines (26 loc) • 662 B
JavaScript
const chalk = require('chalk');
const timestamp = () => {
return chalk.gray(`[${new Date().toLocaleTimeString()}]`);
};
const log = (...args) => {
console.log(timestamp(), chalk.white('[LOG]'), ...args);
};
const info = (...args) => {
console.info(timestamp(), chalk.blueBright('[INFO]'), ...args);
};
const warn = (...args) => {
console.warn(timestamp(), chalk.yellow('[WARN]'), ...args);
};
const error = (...args) => {
console.error(timestamp(), chalk.red('[ERROR]'), ...args);
};
const success = (...args) => {
console.log(timestamp(), chalk.green('[SUCCESS]'), ...args);
};
module.exports = {
log,
info,
warn,
error,
success
};