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
16 lines (12 loc) • 426 B
JavaScript
const axios = require("axios");
function toWebhook(url, options = {}) {
return async (level, message, ...args) => {
const payload = { level, message, args, timestamp: new Date().toISOString() };
try {
await axios.post(url, payload, options);
} catch (error) {
console.error("Webhook logging failed:", error);
}
};
}
module.exports = toWebhook;