From ae847facda284658db0da87536f773d141e41a35 Mon Sep 17 00:00:00 2001 From: Cole Gleason Date: Sat, 1 Feb 2014 02:08:32 -0600 Subject: [PATCH] chore(logging): fix logging.error and make sure logger exists --- src/logging.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/logging.js b/src/logging.js index 32ff5ef883..9de74ebc72 100644 --- a/src/logging.js +++ b/src/logging.js @@ -18,17 +18,21 @@ if (logger == null) { // A custom log function that wraps Winston. Makes it easy to instrument code // and still possible to replace Winston in the future. module.exports.log = function(/* variable args */) { - logger.log.apply(logger, arguments); + if (logger) + logger.log.apply(logger, arguments); }; module.exports.info = function(/* variable args */) { - logger.info.apply(logger, arguments); + if (logger) + logger.info.apply(logger, arguments); }; module.exports.warn = function(/* variable args */) { - logger.warn.apply(logger, arguments); + if (logger) + logger.warn.apply(logger, arguments); }; module.exports.error = function(/* variable args */) { - winston.error(arguments); + if (logger) + logger.error.apply(logger, arguments); };