This library was primarily designed to be used as a transport module for Winston logger. It can also be used as a simple utility for sending messages to RabbitMQ with minimum effort for configuration.
npm install rabbitmq-logger --save 
var winston = require('winston');
require('rabbitmq-logger');
var logger = winston.createLogger({
	transports: [
		new  winston.transports.RabbitmqTransport({
			name:  'name',
			level:  'debug',
			url:  'amqp://url:port'
		})
	]
});
logger.info('Hello World!');var winston = require('winston');
require('rabbitmq-logger');
var mq = winston.createLogger({
	transports: [
		new  winston.transports.RabbitmqTransport({
			url:  'amqp://url:port'
		})
	]
});
module.exports = {
	mq
}
mq.log('xyz', 'Hello World!');The module can be customized using the following options :
- name : The logger name, common option for Winston transports
 - level: The logging level (debug/info/warn/error). The level name is used as the default routing key while sending to RabbitMQ. Can have custom strings if required.
 - url: The RabbitMQ server url which is going to be used for creating connection. If not specified, it takes 
WINSTON_RABBITMQ_URLenvironment variable as the url or uses default valueamqp://localhost:5672 - socketOpts: Options that are going to used for creating connection to RabbitMQ  
socketOpts: {} - exchange: RabbitMQ Exchange that is going to be used for sending messages
 - exchangeOptions: Options that are going to be used for by channel for sending messages to exchange 
exchangeOptions:{} - logToConsole: Boolean value that enables logging to console if sending messages to RabbitMQ is not required
 - timestamp: By default it returns the current timestamp in ISO format. Can be overridden if required
 - debug: Takes a custom function that can be used for getting debug messages from the library. Only enabled if the logging level is also set as 
debug 
{
    level: <log_level or custom_key>,
    message: <message_body>,
    name: <name of the logger instance>,
    src: <system hostname>
}