Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this._uniq = 0;
// Don't freak out!
// This happily overwrites inherited properties.
Object.assign(this, options);
if (options.parent && (!this.loggerBackend || !this.metrics)) {
var srlogger = ServiceRunner.getLogger(options.parent.logging);
if (!this.loggerBackend) {
this.loggerBackend = function(logData, cb) {
srlogger.log(logData.logType, prepareLog(logData));
cb();
};
}
if (!this.metrics) {
this.metrics = ServiceRunner.getMetrics(options.parent.metrics, srlogger);
}
}
if (!localSettings && options.localsettings) {
localSettings = require(options.localsettings);
}
if (localSettings && localSettings.setup) {
localSettings.setup(this);
}
// Call setMwApi for each specified API.
if (Array.isArray(this.mwApis)) {
this.mwApis.forEach(function(api) {
this.setMwApi(api);
}, this);
['traceFlags', 'debugFlags', 'dumpFlags'].forEach(function(f) {
if (Array.isArray(this[f])) {
this[f] = new Set(this[f]);
}
}, this);
if (options.parent && (!this.loggerBackend || !this.metrics)) {
var srlogger = ServiceRunner.getLogger(options.parent.logging);
if (!this.loggerBackend) {
this.loggerBackend = function(logData, cb) {
srlogger.log(logData.logType, prepareLog(logData));
cb();
};
}
if (!this.metrics) {
this.metrics = ServiceRunner.getMetrics(options.parent.metrics, srlogger);
}
}
if (!localSettings && options.localsettings) {
localSettings = require(options.localsettings);
}
if (localSettings && localSettings.setup) {
localSettings.setup(this);
}
// Call setMwApi for each specified API.
if (Array.isArray(this.mwApis)) {
this.mwApis.forEach(function(api) {
this.setMwApi(api);
}, this);