diff --git a/src/logging.js b/src/logging.js index f8e56da7cf..5e1449db3d 100644 --- a/src/logging.js +++ b/src/logging.js @@ -9,17 +9,19 @@ if (logger == null) { logger = new (winston.Logger)({}); if (nconf.get('NODE_ENV') == 'production') { logger.add(winston.transports.newrelic, {}); - logger.add(winston.transports.Mail, { - to: nconf.get('ADMIN_EMAIL') || nconf.get('SMTP_USER'), - from: "HabitRPG <" + nconf.get('SMTP_USER') + ">", - subject: "HabitRPG Error", - host: nconf.get('SMTP_HOST'), - port: nconf.get('SMTP_PORT'), - tls: nconf.get('SMTP_TLS'), - username: nconf.get('SMTP_USER'), - password: nconf.get('SMTP_PASS'), - level: 'error' - }); + if (!nconf.get('DISABLE_ERROR_EMAILS')) { + logger.add(winston.transports.Mail, { + to: nconf.get('ADMIN_EMAIL') || nconf.get('SMTP_USER'), + from: "HabitRPG <" + nconf.get('SMTP_USER') + ">", + subject: "HabitRPG Error", + host: nconf.get('SMTP_HOST'), + port: nconf.get('SMTP_PORT'), + tls: nconf.get('SMTP_TLS'), + username: nconf.get('SMTP_USER'), + password: nconf.get('SMTP_PASS'), + level: 'error' + }); + } } else { logger.add(winston.transports.Console, {colorize:true}); logger.add(winston.transports.File, {filename: 'habitrpg.log'});