diff --git a/website/server/libs/logger.js b/website/server/libs/logger.js index 1bdf68555d..75152c4adf 100644 --- a/website/server/libs/logger.js +++ b/website/server/libs/logger.js @@ -19,13 +19,14 @@ const logger = winston.createLogger(); const _config = { logger, - loggingEnabled: true, // false if no transport has been configured + loggingEnabled: false, // is set to true, if a transport gets configured }; export { _config as _loggerConfig }; // exported for use during tests if (IS_PROD) { if (ENABLE_CONSOLE_LOGS_IN_PROD) { + _config.loggingEnabled = true; logger .add(new winston.transports.Console({ // text part format: winston.format.combine( @@ -44,6 +45,7 @@ if (IS_PROD) { } if (LOGGLY_TOKEN && LOGGLY_SUBDOMAIN) { + _config.loggingEnabled = true; logger.add(new Loggly({ inputToken: LOGGLY_TOKEN, subdomain: LOGGLY_SUBDOMAIN, @@ -51,8 +53,9 @@ if (IS_PROD) { json: true, })); } -// Do not log anything when testing unless specified + // Do not log anything when testing unless specified } else if (!IS_TEST || (IS_TEST && ENABLE_LOGS_IN_TEST)) { + _config.loggingEnabled = true; logger .add(new winston.transports.Console({ level: 'warn', // warn and errors (text part) @@ -116,8 +119,6 @@ if (IS_PROD) { }), ), })); -} else { - _config.loggingEnabled = false; } // exports a public interface insteaf of accessing directly the logger module