From 35cf69cd73e2f3b33d0fb9b6b860ca0702a6d776 Mon Sep 17 00:00:00 2001 From: Will Bradley Date: Fri, 7 Feb 2014 18:16:24 -0700 Subject: [PATCH] Adding time to log for debugging --- app.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app.js b/app.js index fc2e4b9..a22fa0e 100755 --- a/app.js +++ b/app.js @@ -33,16 +33,18 @@ function checkForRedirect () { } function isThisARedirect (res) { + var currentDate = new Date(); if (res.statusCode == 301 || res.statusCode == 302) { - console.log("Redirect? HOW SUSPICIOUS."); + console.log(currentDate.toTimeString()+": Redirect? HOW SUSPICIOUS."); redirecting(res); } else { - console.log("No redirect, nothing to see here..."); + console.log(currentDate.toTimeString()+": No redirect, nothing to see here..."); } } function redirecting (res) { + var currentDate = new Date(); var _url = url.parse(res.headers.location); console.log("Scrape: "+res.headers.location); @@ -51,7 +53,7 @@ function redirecting (res) { var found = false; for (var k in hotspots) { if (!found && hotspots[k].check($)) { - console.log(k.toUpperCase()+" WANTS YOU TO LOG IN"); + console.log(currentDate.toTimeString()+": "+k.toUpperCase()+" WANTS YOU TO LOG IN"); connectToNetwork(hotspots[k].credentials, mergeObjects(_url, hotspots[k].postOptions)); return; }