updated slack config file
This commit is contained in:
parent
6ae9b78dbf
commit
c680a6efa3
1 changed files with 21 additions and 18 deletions
|
@ -4,6 +4,7 @@ const winstonSlackWebHook = require('winston-slack-webhook').SlackWebHook;
|
||||||
module.exports = (winston) => {
|
module.exports = (winston) => {
|
||||||
if (config.logging.slackWebHook) {
|
if (config.logging.slackWebHook) {
|
||||||
// add a transport for errors to slack
|
// add a transport for errors to slack
|
||||||
|
if (config.logging.slackErrorChannel) {
|
||||||
winston.add(winstonSlackWebHook, {
|
winston.add(winstonSlackWebHook, {
|
||||||
name : 'slack-errors-transport',
|
name : 'slack-errors-transport',
|
||||||
level : 'warn',
|
level : 'warn',
|
||||||
|
@ -12,6 +13,8 @@ module.exports = (winston) => {
|
||||||
username : 'spee.ch',
|
username : 'spee.ch',
|
||||||
iconEmoji : ':face_with_head_bandage:',
|
iconEmoji : ':face_with_head_bandage:',
|
||||||
});
|
});
|
||||||
|
};
|
||||||
|
if (config.logging.slackInfoChannel) {
|
||||||
winston.add(winstonSlackWebHook, {
|
winston.add(winstonSlackWebHook, {
|
||||||
name : 'slack-info-transport',
|
name : 'slack-info-transport',
|
||||||
level : 'info',
|
level : 'info',
|
||||||
|
@ -20,11 +23,11 @@ module.exports = (winston) => {
|
||||||
username : 'spee.ch',
|
username : 'spee.ch',
|
||||||
iconEmoji : ':nerd_face:',
|
iconEmoji : ':nerd_face:',
|
||||||
});
|
});
|
||||||
|
};
|
||||||
// send test message
|
// send test message
|
||||||
winston.error('Slack "error" logging is online.');
|
winston.error('Slack "error" logging is online.');
|
||||||
winston.warn('Slack "warning" logging is online.');
|
|
||||||
winston.info('Slack "info" logging is online.');
|
winston.info('Slack "info" logging is online.');
|
||||||
} else {
|
} else {
|
||||||
winston.warn('Slack logging is not enabled because no SLACK_WEB_HOOK env var provided.');
|
winston.warn('Slack logging is not enabled because no slackWebHook config var provided.');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue