chore: deprecated rabbitmq appender

This commit is contained in:
Gareth Jones 2018-06-25 07:37:31 +10:00
parent 7940c1b1e8
commit ef7b5dc2d5
4 changed files with 8 additions and 43 deletions

View File

@ -33,7 +33,6 @@ The following appenders are included with log4js. Some require extra dependencie
* [recording](recording.md)
* [stderr](stderr.md)
* [stdout](stdout.md)
* [rabbitmq](rabbitmq.md)
## Optional Appenders
@ -44,6 +43,7 @@ The following appenders are supported by log4js, but will issue deprecation warn
* [loggly](https://github.com/log4js-node/loggly)
* [logstashUDP](https://github.com/log4js-node/logstashUDP)
* [mailgun](https://github.com/log4js-node/mailgun)
* [rabbitmq](https://github.com/log4js-node/rabbitmq)
* [redis](https://github.com/log4js-node/redis)
* [slack](https://github.com/log4js-node/slack)
* [smtp](https://github.com/log4js-node/smtp)

View File

@ -1,41 +0,0 @@
# Rabbitmq Appender
Push log events to a [Rabbitmq](https://www.rabbitmq.com/) MQ. You will need to include the [amqplib](https://www.npmjs.com/package/amqplib) package in your application's dependencies to use this appender.
## Configuration
* `type` - `rabbitmq`
* `host` - `string` (optional, defaults to `127.0.0.1`) - the location of the rabbitmq server
* `port` - `integer` (optional, defaults to `5672`) - the port the rabbitmq server is listening on
* `username` - `string` (optional, defaults to `guest`) - username to use when authenticating connection to rabbitmq
* `password` - `string` (optional, defaults to `guest`) - password to use when authenticating connection to rabbitmq
* `routing_key` - `string` (optional, defaults to `logstash`) - rabbitmq message's routing_key
* `durable` - `string` (optional, defaults to false) - will that RabbitMQ lose our queue.
* `exchange` - `string` - rabbitmq send message's exchange
* `mq_type` - `string` - rabbitmq message's mq_type
* `layout` - `object` (optional, defaults to `messagePassThroughLayout`) - the layout to use for log events (see [layouts](layouts.md)).
The appender will use the Rabbitmq Routing model command to send the log event messages to the channel.
## Example
```javascript
log4js.configure({
appenders: {
mq: {
type: 'rabbitmq',
host: '127.0.0.1',
port: 5672,
username: 'guest',
password: 'guest',
routing_key: 'logstash',
exchange: 'exchange_logs',
mq_type: 'direct',
durable: true
}
},
categories: { default: { appenders: ['mq'], level: 'info' } }
});
```
This configuration will push log messages to the rabbitmq on `127.0.0.1:5672`.

View File

@ -14,7 +14,7 @@ log4js.configure({
alwaysIncludePattern: false
},
mq: {
type: 'rabbitmq',
type: '@log4js-node/rabbitmq',
host: '127.0.0.1',
port: 5672,
username: 'guest',

View File

@ -1,5 +1,9 @@
'use strict';
/**
* This appender is deprecated and will be removed in version 3.x
* Please make any bug fixes or improvements to https://github.com/log4js-node/rabbitmq
*/
const amqplib = require('amqplib');
function rabbitmqAppender(config, layout) {
@ -46,6 +50,8 @@ function rabbitmqAppender(config, layout) {
log.shutdown = function () {
clientconn.close();
};
log.deprecated = '@log4js-node/rabbitmq';
return log;
}