Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(logglyConfig, bufferLength = 1, bufferTimeout, callback) {
if (!logglyConfig || !logglyConfig.token || !logglyConfig.subdomain) {
throw new Error("bunyan-loggly requires a config object with token and subdomain");
}
logglyConfig.json = true;
this.logglyClient = loggly.createClient(logglyConfig);
this._buffer = [];
this.bufferLength = bufferLength;
this.bufferTimeout = bufferTimeout;
this.callback = callback || function () {};
}
this.callback = callback || noop;
this.bufferLength = bufferLength || 1;
this.bufferTimeout = bufferTimeout || 30 * 1000;
logglyConfig.json = logglyConfig.json !== false;
logglyConfig.isBulk = logglyConfig.isBulk !== false;
if (logglyConfig.isBulk) {
logglyConfig.bufferOptions = {
size: this.bufferLength,
retriesInMilliSeconds: this.bufferTimeout,
};
}
this.logglyClient = loggly.createClient(logglyConfig);
}