Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this[$levels] = levelUtil.normalize(opts);
for (const lvlName of this.levels) {
if (lvlName in this)
throw new BadOptionsError(opts, text.levelConflict(lvlName));
Object.defineProperty(this, lvlName, {
enumerable: true,
writable: false,
value() {
this.log.apply(this, [lvlName, ...arguments]);
}
});
}
const bufferSizeConfig = opts.bufferSize || defaults.bufferSize;
this.ringBuffer = new RingBuffer(bufferSizeConfig);
// Other permanent options
this[$token] = opts.token;
// Editable options
const secure = opts.secure === undefined ? defaults.secure : opts.secure;
this.bufferSize = bufferSizeConfig;
this.port = opts.port || (secure ? defaults.portSecure : defaults.port);
this.flatten = opts.flatten;
this.flattenArrays = 'flattenArrays' in opts ? opts.flattenArrays : opts.flatten;
this.json = opts.json;