mirror of
https://github.com/log4js-node/log4js-node.git
synced 2025-12-08 19:26:01 +00:00
fix: deprecate the slack appender
This commit is contained in:
parent
8754870a91
commit
b13d045baa
@ -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'`.
|
||||
|
||||
@ -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',
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user