diff --git a/config/default.json b/config/default.json index 47764010..e094bc44 100644 --- a/config/default.json +++ b/config/default.json @@ -1,19 +1,20 @@ { "WalletConfig": { - "LbryClaimAddress": "none", - "DefaultChannel": "none" + "LbryClaimAddress": null, + "DefaultChannel": null }, "AnalyticsConfig":{ - "GoogleId": "none" + "GoogleId": null }, "Database": { "Database": "lbry", - "Username": "none", - "Password": "none" + "Username": null, + "Password": null }, "Logging": { - "LogLevel": "none", - "SlackErrorChannel": "none", - "SlackInfoChannel": "none" + "LogLevel": null, + "SlackWebHook": null, + "SlackErrorChannel": null, + "SlackInfoChannel": null } } \ No newline at end of file diff --git a/config/loggerConfig.js b/config/loggerConfig.js index 4efbbb02..ffd4c970 100644 --- a/config/loggerConfig.js +++ b/config/loggerConfig.js @@ -12,10 +12,6 @@ module.exports = (winston, logLevel) => { ], }); - // winston.on('error', (err) => { - // console.log('unhandled exception in winston >> ', err); - // }); - winston.error('Level 0'); winston.warn('Level 1'); winston.info('Level 2'); diff --git a/config/slackLoggerConfig.js b/config/slackLoggerConfig.js index 5f49e001..4bd88200 100644 --- a/config/slackLoggerConfig.js +++ b/config/slackLoggerConfig.js @@ -5,23 +5,28 @@ const SLACK_INFO_CHANNEL = config.get('Logging.SlackInfoChannel'); const winstonSlackWebHook = require('winston-slack-webhook').SlackWebHook; module.exports = (winston) => { - // add a transport for errors - winston.add(winstonSlackWebHook, { - name : 'slack-errors-transport', - level : 'error', - webhookUrl: SLACK_WEB_HOOK, - channel : SLACK_ERROR_CHANNEL, - username : 'spee.ch', - iconEmoji : ':face_with_head_bandage:', - }); - winston.add(winstonSlackWebHook, { - name : 'slack-info-transport', - level : 'info', - webhookUrl: SLACK_WEB_HOOK, - channel : SLACK_INFO_CHANNEL, - username : 'spee.ch', - iconEmoji : ':nerd_face:', - }); - // send test message - winston.error('Testing slack logging... slack logging is online.'); + if (SLACK_WEB_HOOK) { + // add a transport for errors to slack + winston.add(winstonSlackWebHook, { + name : 'slack-errors-transport', + level : 'error', + webhookUrl: SLACK_WEB_HOOK, + channel : SLACK_ERROR_CHANNEL, + username : 'spee.ch', + iconEmoji : ':face_with_head_bandage:', + }); + winston.add(winstonSlackWebHook, { + name : 'slack-info-transport', + level : 'info', + webhookUrl: SLACK_WEB_HOOK, + channel : SLACK_INFO_CHANNEL, + username : 'spee.ch', + iconEmoji : ':nerd_face:', + }); + // send test message + winston.error('Slack error logging is online.'); + winston.info('Slack info logging is online.'); + } else { + winston.error('Slack logging is not enabled because no SLACK_WEB_HOOK env var provided.'); + } };