UNPKG

log-mate

Version:

log-mate makes logging effortless & powerful—log to console, files, databases, or cloud with structured logs, encryption, real-time streaming, and auto-rotation. It’s plug & play, supports multi-transport logging, and boosts performance with async, lazy l

11 lines (8 loc) 312 B
const fs = require("fs"); function toFile(filepath, options = {}) { return (level, message, ...args) => { const logEntry = `[${level}] ${new Date().toISOString()} - ${message} ${args.join(" ")}\n`; fs.appendFileSync(filepath, logEntry, options); }; } module.exports = toFile;