From b2ec9af1e43da89c24594111bb8b58f93256d605 Mon Sep 17 00:00:00 2001 From: Lloyd Hilaiel <lloyd@hilaiel.com> Date: Wed, 20 Jun 2012 11:16:27 +0300 Subject: [PATCH] rework __heartbeat__ log message - heartbeat failure is a .warn(), not an error(). the latter indicates an unexpected condition that should never happen in production. thought here is that the dependee that's failing should have errors() in her log message, and the depener should have warnings. Also, this gets error messages out of the console output of the unit test. --- lib/heartbeat.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/heartbeat.js b/lib/heartbeat.js index 209bc9ed3..f816a8719 100644 --- a/lib/heartbeat.js +++ b/lib/heartbeat.js @@ -52,8 +52,8 @@ exports.setup = function(app, options, cb) { ok(false, e); } } else { - logger.error("Not all dependencies are available"); - ok(false, '\n' + notOk.join('\n') + '\n'); + logger.warn("heartbeat failed due to dependencies - " + notOk.join(', ')); + ok(false, '\n' + notOk.join('\n') + '\n'); } } }; @@ -104,13 +104,14 @@ var check = exports.check = function(url, cb) { clearTimeout(timeoutHandle); if (res.statusCode === 200) cb(true); else { - logger.error("non-200 response from " + shortname + ". fatal! (" + res.statusCode + ")"); + logger.warn("heartbeat failure: non-200 response from " + shortname + ". fatal! (" + + res.statusCode + ")"); cb(false, "response code " + res.statusCode); } }); req.on('error', function (e) { clearTimeout(timeoutHandle); - logger.error("can't communicate with " + shortname + ". fatal: " + e); + logger.warn("heartbeat failure: can't communicate with " + shortname + ". fatal: " + e); cb(false, e); }); }; -- GitLab