Winston NSQ transport. Uses official NSQ client library nsqjs.
$ npm install winston
$ npm install winston-nsq-transport
- level: The winston's log level, default: "info"
- nsqdHost: A string representing the host of nsqd instance.
- nsqdPort: A string representing the port of nsqd instance.
- nsqOptions: An object representing the nsqjs writer options
- topic: A string representing NSQ topic.
See the default values used:
const options = {
level: 'info',
nsqdHost: '127.0.0.1',
nsqdPort: '4150',
nsqOptions: {
clientId: 'winston-nsq-transport'
},
topic: 'winston_logs'
};
const { Logger } = require('winston');
const NSQTransport = require('winston-nsq-transport');
const logger = new Logger({
transports: [
new NSQTransport({
topic: 'winston_logs',
nsqdHost,
nsqdPort
})
]
});
module.exports = logger;
logger.log('info', 'message', {});
The tests are written in vows, and designed to be run with npm.
$ npm test