more/better logging; allow changed IDs list to be cleared even when tracker is disabled
authorDan Mills <thunder@mozilla.com>
Sat, 06 Dec 2008 00:11:16 -0800
changeset 45087 34ba2a7f7da8871ae45c9b0b0edb04d59c867ce9
parent 45086 1827ebccb1ddcafa193ffec758d26bbcd7e55837
child 45088 9bcb38b02b03c021a880aeca866012d5104681d9
push idunknown
push userunknown
push dateunknown
more/better logging; allow changed IDs list to be cleared even when tracker is disabled
services/sync/modules/trackers.js
--- a/services/sync/modules/trackers.js
+++ b/services/sync/modules/trackers.js
@@ -125,33 +125,33 @@ Tracker.prototype = {
 
   get changedIDs() {
     let items = {};
     this.__defineGetter__("changedIDs", function() items);
     return items;
   },
 
   saveChangedIDs: function T_saveChangedIDs() {
-    this._log.trace("Saving changed IDs to disk");
+    this._log.debug("Saving changed IDs to disk");
 
     let file = Utils.getProfileFile(
       {path: "weave/changes/" + this.file + ".json",
        autoCreate: true});
     let out = this._json.encode(this.changedIDs);
     let [fos] = Utils.open(file, ">");
     fos.writeString(out);
     fos.close();
   },
 
   loadChangedIDs: function T_loadChangedIDs() {
     let file = Utils.getProfileFile("weave/changes/" + this.file + ".json");
     if (!file.exists())
       return;
 
-    this._log.trace("Loading previously changed IDs from disk");
+    this._log.debug("Loading previously changed IDs from disk");
 
     try {
       let [is] = Utils.open(file, "<");
       let json = Utils.readStream(is);
       is.close();
 
       let ids = this._json.decode(json);
       for (let id in ids) {
@@ -161,32 +161,33 @@ Tracker.prototype = {
       this._log.warn("Could not load changed IDs from previous session");
       this._log.debug("Exception: " + e);
     }
   },
 
   addChangedID: function T_addChangedID(id) {
     if (!this.enabled)
       return;
+    this._log.debug("Adding changed ID " + id);
     if (!this.changedIDs[id]) {
       this.changedIDs[id] = true;
       this.saveChangedIDs();
     }
   },
 
   removeChangedID: function T_removeChangedID(id) {
     if (!this.enabled)
       return;
+    this._log.debug("Removing changed ID " + id);
     if (this.changedIDs[id]) {
       delete this.changedIDs[id];
       this.saveChangedIDs();
     }
   },
 
   clearChangedIDs: function T_clearChangedIDs() {
-    if (!this.enabled)
-      return;
+    this._log.debug("Clearing changed ID list");
     for (let id in this.changedIDs) {
       delete this.changedIDs[id];
     }
     this.saveChangedIDs();
   }
 };