diff --git a/docs/appenders.md b/docs/appenders.md index 31fe6e5..e0721ee 100644 --- a/docs/appenders.md +++ b/docs/appenders.md @@ -31,7 +31,6 @@ The following appenders are included with log4js. Some require extra dependencie * [multiFile](multiFile.md) * [multiprocess](multiprocess.md) * [recording](recording.md) -* [slack](slack.md) * [stderr](stderr.md) * [stdout](stdout.md) * [rabbitmq](rabbitmq.md) @@ -46,6 +45,7 @@ The following appenders are supported by log4js, but will issue deprecation warn * [logstashUDP](https://github.com/log4js-node/logstashUDP) * [mailgun](https://github.com/log4js-node/mailgun) * [redis](https://github.com/log4js-node/redis) +* [slack](https://github.com/log4js-node/slack) * [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'`. diff --git a/examples/slack-appender.js b/examples/slack-appender.js index 99927d4..5847c49 100644 --- a/examples/slack-appender.js +++ b/examples/slack-appender.js @@ -4,7 +4,7 @@ const log4js = require('../lib/log4js'); log4js.configure({ appenders: { slack: { - type: 'slack', + type: '@log4js-node/slack', token: 'TOKEN', channel_id: '#CHANNEL', username: 'USERNAME', diff --git a/lib/appenders/slack.js b/lib/appenders/slack.js index 694f4f5..e348b93 100644 --- a/lib/appenders/slack.js +++ b/lib/appenders/slack.js @@ -1,9 +1,13 @@ 'use strict'; +/** + * This appender has been deprecated. + * Updates and bug fixes should be made against https://github.com/log4js-node/slack + */ const Slack = require('slack-node'); function slackAppender(_config, layout, slack) { - return (loggingEvent) => { + const appender = (loggingEvent) => { const data = { channel_id: _config.channel_id, text: layout(loggingEvent, _config.timezoneOffset), @@ -23,6 +27,10 @@ function slackAppender(_config, layout, slack) { } }); }; + + // trigger a deprecation warning. + appender.deprecated = '@logj4s-node/slack'; + return appender; } function configure(_config, layouts) {