diff options
Diffstat (limited to 'lib/logger.js')
-rw-r--r-- | lib/logger.js | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/lib/logger.js b/lib/logger.js index 1aec908..594f5c2 100644 --- a/lib/logger.js +++ b/lib/logger.js @@ -2,7 +2,7 @@ // http://www.opensource.org/licenses/mit-license.php "use strict"; var urlMod = require("url"); -var urilMod = require("util"); +var utilMod = require("util"); var Color = require("color").Color; var tabs = require("tabs"); var apiUtils = require("api-utils"); @@ -11,36 +11,45 @@ function Logger(store, abbsMap) { this.EmptyLogsColor = new Color(0, 255, 0); this.FullLogsColor = new Color(0, 40, 103); + console.log("store = " + store.toSource()); this.store = store; + console.log("abbsMap = " + abbsMap.toSource()); this.abbsMap = abbsMap; }; -exports.Logger = apiUtils.publicConstructor(Logger); +exports.Logger = Logger; Logger.prototype.addLogRecord = function(that) { + console.log("Adding log record!"); var rec = {}; rec.date = new Date(); rec.url = that.doc.location.toString(); rec.title = that.title; var comment = tabs.activeTab.contentWindow.prompt( "Enter comments for this comment"); + console.log("comment = " + comment); if (comment && comment.length > 0) { + console.log("I am in!"); comment = comment.trim(); rec.comment = comment; - var recKey = utilMod.getISODate(rec.date) + "+" - + urlMod.parse(rec.url).host + console.log("rec.comment = " + rec.comment); + // FIXME We break on the following line. Not sure what's going on! + var dateStr = utilMod.getISODate(rec.date); + console.log("rec.date = " + rec.date + ", dateStr = " + dateStr); + var urlStr = urlMod.URL(rec.url).host; + console.log("rec.url = " + rec.url + ", urlStr = " + urlStr); + var recKey = dateStr + "+" + + urlStr + "+" + that.bugNo; + console.log("recKey = " + recKey); console.log("rec = " + rec.toSource()); - - var clearLogAElem = that.doc.getElementById("clearLogs"); - if (clearLogAElem.style.color != that.FullLogsColor) { - clearLogAElem.style.color = that.FullLogsColor; - clearLogAElem.style.fontWeight = "bolder"; - } - if (that.store[recKey]) { - that.store[recKey].comment += "<br/>\n" + comment; + + console.log("this.store = " + this.store); + + if (this.store[recKey]) { + this.store[recKey].comment += "<br/>\n" + comment; } else { - that.store[recKey] = rec; + this.store[recKey] = rec; } } return comment; @@ -49,7 +58,7 @@ Logger.prototype.addLogRecord = function(that) { Logger.prototype.getBugzillaAbbr = function(url) { // for https://bugzilla.redhat.com/show_bug.cgi?id=579123 get RH // for https://bugzilla.mozilla.org/show_bug.cgi?id=579123 get MoFo - var abbr = this.abbsMap[urlMod.parse(url).host]; + var abbr = this.abbsMap[urlMod.URL(url).host]; return abbr; } @@ -73,7 +82,7 @@ Logger.prototype.timeSheetRecordsPrinter = function(body, records) { tmpArr.forEach(function(rec) { var x = rec[1]; var dayStr = utilMod.getISODate(x.date); - var host = urlMod.parse(x.url).host; + var host = urlMod.URL(x.url).host; var BZName = that.getBugzillaAbbr(x.url); var bugNo = utilMod.getBugNo(x.url); if (dayStr != currentDay) { @@ -95,7 +104,7 @@ Logger.prototype.timeSheetRecordsPrinter = function(body, records) { }; /** - * + * */ Logger.prototype.createBlankPage = function (ttl, bodyBuildCB) { var title = ttl || "Yet another untitled page"; |