Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setupDatabaseAndEmptyQueue(this.db);
}
};
/**
* Inherit from `winston.Transport`.
*/
util.inherits(MongoDB, Transport);
/**
* Define a getter so that `winston.transports.MongoDB`
* is available and thus backwards compatible.
*/
Transport.MongoDB = MongoDB;
/**
* Closes MongoDB connection so using process would not hang up.
* Used by winston Logger.close on transports.
*/
MongoDB.prototype.close = function() {
if (!this.logDb) {
return;
}
this.logDb.close().then(()=>this.logDb = null).catch(err=>{
console.error('Winston MongoDB transport encountered on error during closing.', err);
});
};