chore: deprecated Redis appender

This commit is contained in:
Gareth Jones 2018-06-05 08:18:21 +10:00
parent 9809ff034e
commit 80dce78ea8
5 changed files with 10 additions and 30 deletions

View File

@ -31,7 +31,6 @@ The following appenders are included with log4js. Some require extra dependencie
* [multiFile](multiFile.md)
* [multiprocess](multiprocess.md)
* [recording](recording.md)
* [redis](redis.md)
* [slack](slack.md)
* [stderr](stderr.md)
* [stdout](stdout.md)
@ -46,6 +45,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)
* [redis](https://github.com/log4js-node/redis)
* [smtp](https://github.com/log4js-node/smtp)
For example, if you were previously using the gelf appender (`type: 'gelf'`) then you should add `@log4js-node/gelf` to your dependencies and change the type to `type: '@log4js-node/gelf'`.

View File

@ -1,27 +0,0 @@
# Redis Appender
Stores log events in a [Redis](https://redis.io) database. You will need to include the [redis](https://www.npmjs.com/package/redis) package in your application's dependencies to use this appender.
## Configuration
* `type` - `redis`
* `host` - `string` (optional, defaults to `127.0.0.1`) - the location of the redis server
* `port` - `integer` (optional, defaults to `6379`) - the port the redis server is listening on
* `pass` - `string` (optional) - password to use when authenticating connection to redis
* `channel` - `string` - the redis channel that log events will be published to
* `layout` - `object` (optional, defaults to `messagePassThroughLayout`) - the layout to use for log events (see [layouts](layouts.md)).
The appender will use the Redis PUBLISH command to send the log event messages to the channel.
## Example
```javascript
log4js.configure({
appenders: {
redis: { type: 'redis', channel: 'logs' }
},
categories: { default: { appenders: ['redis'], level: 'info' } }
});
```
This configuration will publish log messages to the `logs` channel on `127.0.0.1:6379`.

View File

@ -14,7 +14,7 @@ log4js.configure({
alwaysIncludePattern: false
},
db: {
type: 'redis',
type: '@log4js-node/redis',
host: '127.0.0.1',
port: 6379,
pass: '',

View File

@ -9,7 +9,7 @@ log4js.configure({
type: 'console'
},
mail: {
type: 'smtp',
type: '@log4js-node/smtp',
recipients: 'logfilerecipient@logging.com',
sendInterval: 5,
transport: 'SMTP',

View File

@ -1,5 +1,9 @@
'use strict';
/**
* This appender has been deprecated, and will be removed in version 3.
* Any bug fixes or improvements should be made against @log4js-node/redis
*/
const redis = require('redis');
const util = require('util');
@ -29,6 +33,9 @@ function redisAppender(config, layout) {
if (cb) cb();
};
// trigger a deprecation warning.
appender.deprecated = '@logj4s-node/redis';
return appender;
}