From 29a238a7268de5ae431b7e08cb686b7ac12beff5 Mon Sep 17 00:00:00 2001 From: Gareth Jones Date: Fri, 6 Jul 2018 07:48:04 +1000 Subject: [PATCH] chore: deprecated logFaces-HTTP appender --- docs/appenders.md | 2 +- docs/logFaces-HTTP.md | 31 ------------------------------- lib/appenders/logFaces-HTTP.js | 8 +++++++- 3 files changed, 8 insertions(+), 33 deletions(-) delete mode 100644 docs/logFaces-HTTP.md diff --git a/docs/appenders.md b/docs/appenders.md index b6d3014..7eb494f 100644 --- a/docs/appenders.md +++ b/docs/appenders.md @@ -24,7 +24,6 @@ The following appenders are included with log4js. Some require extra dependencie * [dateFile](dateFile.md) * [file](file.md) * [fileSync](fileSync.md) -* [logFaces-HTTP](logFaces-HTTP.md) * [logFaces-UDP](logFaces-UDP.md) * [logLevelFilter](logLevelFilter.md) * [multiFile](multiFile.md) @@ -39,6 +38,7 @@ The following appenders are supported by log4js, but will issue deprecation warn * [gelf](https://github.com/log4js-node/gelf) * [hipchat](https://github.com/log4js-node/hipchat) +* [logFaces-HTTP](https://github.com/log4js-node/logFaces-HTTP) * [loggly](https://github.com/log4js-node/loggly) * [logstashHTTP](https://github.com/log4js-node/logstashHTTP) * [logstashUDP](https://github.com/log4js-node/logstashUDP) diff --git a/docs/logFaces-HTTP.md b/docs/logFaces-HTTP.md deleted file mode 100644 index f60b38a..0000000 --- a/docs/logFaces-HTTP.md +++ /dev/null @@ -1,31 +0,0 @@ -# logFaces Appender (HTTP) - -The logFaces appenders send JSON formatted log events to [logFaces](http://www.moonlit-software.com) receivers. This appender uses HTTP to send the events (there is another logFaces appender that uses [UDP](logFaces-UDP.md)). You will need to include [axios](https://www.npmjs.com/package/axios) in your dependencies to use this appender. - -## Configuration - -* `type` - `logFaces-HTTP` -* `url` - `string` - logFaces receiver servlet URL -* `application` - `string` (optional, defaults to empty string) - used to identify your application's logs -* `timeout` - `integer` (optional, defaults to 5000ms) - the timeout for the HTTP request. - -This appender will also pick up Logger context values from the events, and add them as `p_` values in the logFaces event. See the example below for more details. - -# Example (default config) - -```javascript -log4js.configure({ - appenders: { - logfaces: { type: 'logFaces-HTTP', url: 'http://lfs-server/logs' } - }, - categories: { - default: { appenders: [ 'logfaces' ], level: 'info' } - } -}); - -const logger = log4js.getLogger(); -logger.addContext('requestId', '123'); -logger.info('some interesting log message'); -logger.error('something has gone wrong'); -``` -This example will result in two log events being sent to `lfs-server`. Both events will have a `p_requestId` property with a value of `123`. diff --git a/lib/appenders/logFaces-HTTP.js b/lib/appenders/logFaces-HTTP.js index d596a2a..397a02c 100644 --- a/lib/appenders/logFaces-HTTP.js +++ b/lib/appenders/logFaces-HTTP.js @@ -1,4 +1,7 @@ /** + * This appender is deprecated. All bugfixes and improvements should be made in + * https://github.com/log4js-node/logFaces-HTTP + * * logFaces appender sends JSON formatted log events to logFaces receivers. * There are two types of receivers supported - raw UDP sockets (for server side apps), * and HTTP (for client side apps). Depending on the usage, this appender @@ -33,7 +36,7 @@ function logFacesAppender(config) { withCredentials: true }); - return function log(event) { + const appender = function log(event) { // convert to logFaces compact json format const lfsEvent = { a: config.application || '', // application name @@ -58,6 +61,9 @@ function logFacesAppender(config) { console.error(`log4js.logFaces-HTTP Appender error: ${error.message}`); }); }; + + appender.deprecated = '@log4js-node/logfaces-http'; + return appender; } function configure(config) {