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
23 lines (18 loc) • 414 B
JavaScript
let batchSize = 10;
let logBuffer = [];
function setBatchSize(size) {
if (size > 0) batchSize = size;
}
function logBatch(logFunc, message) {
logBuffer.push(message);
if (logBuffer.length >= batchSize) flush(logFunc);
}
function flush(logFunc) {
logBuffer.forEach(msg => logFunc(msg));
logBuffer = [];
}
module.exports = {
setBatchSize,
logBatch,
flush
};