ofkindness / winston-nsq-transport

Winston NSQ transport. Uses official NSQ client library (nsqjs).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

winston-nsq-transport

CircleCI NPM version Dependency Status NPM Downloads

Winston NSQ transport. Uses official NSQ client library nsqjs.

Installation

  $ npm install winston
  $ npm install winston-nsq-transport

Options

  • 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'
};

Usage

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;

Logging

logger.log('info', 'message', {});

Run Tests

The tests are written in vows, and designed to be run with npm.

  $ npm test

LICENSE

MIT License

About

Winston NSQ transport. Uses official NSQ client library (nsqjs).

License:MIT License


Languages

Language:JavaScript 100.0%