From b7bcbed16d2b626898de2bb85b61cb94b165abf0 Mon Sep 17 00:00:00 2001 From: Ben Adida <ben@adida.net> Date: Wed, 3 Aug 2011 12:06:20 -0700 Subject: [PATCH] added timestamp and ip address to log --- libs/logging.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libs/logging.js b/libs/logging.js index f4aa9771d..37684d29f 100644 --- a/libs/logging.js +++ b/libs/logging.js @@ -19,8 +19,9 @@ exports.log = function(entry) { if (!entry.type) throw new Error("every log entry needs a type"); - // FIXME: add timestamp - + // timestamp + entry.at = new Date().toUTCString(); + // if no logger, go to console (FIXME: do we really want to log to console?) if (LOGGER) LOGGER.info(JSON.stringify(entry)); @@ -34,8 +35,8 @@ exports.userEntry = function(req) { type: 'signin', browser: req.headers['user-agent'], rp: req.headers['referer'], - // FIXME: make sure we know where IP is: what header? - ip: "" + // IP address (this probably needs to be replaced with the X-forwarded-for value + ip: req.connection.remoteAddress }); console.log(JSON.stringify(req.headers)); }; \ No newline at end of file -- GitLab