How to use the defaults.inactivityTimeout function in defaults

To help you get started, we’ve selected a few defaults examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rapid7 / le_node / src / node_modules / logger.js View on Github external
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;
		this.host                       = opts.host;
		this.console                    = opts.console;
		this.minLevel                   = opts.minLevel;
		this.replacer                   = opts.replacer;
		this.inactivityTimeout          = opts.inactivityTimeout || defaults.inactivityTimeout;
		this.timestamp                  = opts.timestamp;
		this.withLevel                  = 'withLevel' in opts ? opts.withLevel : true;
		this.withStack                  = opts.withStack;
		this[$secure]                   = secure;
		this[$reconnectInitialDelay]    = opts.reconnectInitialDelay || defaults.reconnectInitialDelay;
		this[$reconnectMaxDelay]        = opts.reconnectMaxDelay || defaults.reconnectMaxDelay;
		this[$reconnectBackoffStrategy] = opts.reconnectBackoffStrategy || defaults.reconnectBackoffStrategy;
		this.debugEnabled               = opts.debug || false;
		if (!this.debugEnabled) {
			//if there is no debug set, empty logger should be used
			this.debugLogger = { log: () => { } };
		} else {
			this.debugLogger = (opts.debugLogger && opts.debugLogger.log) ? opts.debugLogger : defaults.debugLogger;
		}

		this[$reconnect] = reconnect_core(function () {
github rapid7 / le_node / src / node_modules / logger.js View on Github external
set inactivityTimeout(val) {
		if (Number.isInteger(val) && val >= 0) {
			this[$timeout] = parseInt(val);
		}

		if (!_.isNumber(this[$timeout])) {
			this[$timeout] = defaults.inactivityTimeout;
		}
	}