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 (18 loc) • 454 B
JavaScript
const WebSocket = require("ws");
let wss;
function enableStreaming(port = 8080) {
wss = new WebSocket.Server({ port });
}
function streamLog(level, message) {
if (wss) {
wss.clients.forEach(client => {
if (client.readyState === WebSocket.OPEN) {
client.send(JSON.stringify({ level, message }));
}
});
}
}
module.exports = {
enableStreaming,
streamLog
};