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
22 lines (16 loc) • 527 B
JavaScript
const axios = require("axios");
let cloudUrl = null;
function toCloud(service) {
cloudUrl = service;
}
async function logToCloud(level, message) {
if (!cloudUrl) throw new Error("Cloud logging service URL is not set");
await axios.post(cloudUrl, {
level,
message,
timestamp: new Date().toISOString()
});
}
// module.exports = toCloud; // Ensure this is correct
// module.exports = logToCloud; // Ensure this is correct
module.exports = { toCloud, logToCloud };