How to use the winston-transport.MongoDB function in winston-transport

To help you get started, we’ve selected a few winston-transport 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 satoripop / thesuperlogger / src / transports / winston-mongodb.js View on Github external
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);
	});
};

winston-transport

Base stream implementations for winston@3 and up.

MIT
Latest version published 1 month ago

Package Health Score

89 / 100
Full package analysis