updated slack config file

This commit is contained in:
bill bittner 2017-12-08 10:25:05 -08:00
parent 6ae9b78dbf
commit c680a6efa3

View file

@ -4,27 +4,30 @@ 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
winston.add(winstonSlackWebHook, { if (config.logging.slackErrorChannel) {
name : 'slack-errors-transport', winston.add(winstonSlackWebHook, {
level : 'warn', name : 'slack-errors-transport',
webhookUrl: config.logging.slackWebHook, level : 'warn',
channel : config.logging.slackErrorChannel, webhookUrl: config.logging.slackWebHook,
username : 'spee.ch', channel : config.logging.slackErrorChannel,
iconEmoji : ':face_with_head_bandage:', username : 'spee.ch',
}); iconEmoji : ':face_with_head_bandage:',
winston.add(winstonSlackWebHook, { });
name : 'slack-info-transport', };
level : 'info', if (config.logging.slackInfoChannel) {
webhookUrl: config.logging.slackWebHook, winston.add(winstonSlackWebHook, {
channel : config.logging.slackInfoChannel, name : 'slack-info-transport',
username : 'spee.ch', level : 'info',
iconEmoji : ':nerd_face:', webhookUrl: config.logging.slackWebHook,
}); channel : config.logging.slackInfoChannel,
username : 'spee.ch',
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.');
} }
}; };