more/better logging; allow changed IDs list to be cleared even when tracker is disabled

This commit is contained in:
Dan Mills 2008-12-06 00:11:16 -08:00
parent 810cd9f6fe
commit 3095b5dbd7

View File

@ -130,7 +130,7 @@ Tracker.prototype = {
}, },
saveChangedIDs: function T_saveChangedIDs() { saveChangedIDs: function T_saveChangedIDs() {
this._log.trace("Saving changed IDs to disk"); this._log.debug("Saving changed IDs to disk");
let file = Utils.getProfileFile( let file = Utils.getProfileFile(
{path: "weave/changes/" + this.file + ".json", {path: "weave/changes/" + this.file + ".json",
@ -146,7 +146,7 @@ Tracker.prototype = {
if (!file.exists()) if (!file.exists())
return; return;
this._log.trace("Loading previously changed IDs from disk"); this._log.debug("Loading previously changed IDs from disk");
try { try {
let [is] = Utils.open(file, "<"); let [is] = Utils.open(file, "<");
@ -166,6 +166,7 @@ Tracker.prototype = {
addChangedID: function T_addChangedID(id) { addChangedID: function T_addChangedID(id) {
if (!this.enabled) if (!this.enabled)
return; return;
this._log.debug("Adding changed ID " + id);
if (!this.changedIDs[id]) { if (!this.changedIDs[id]) {
this.changedIDs[id] = true; this.changedIDs[id] = true;
this.saveChangedIDs(); this.saveChangedIDs();
@ -175,6 +176,7 @@ Tracker.prototype = {
removeChangedID: function T_removeChangedID(id) { removeChangedID: function T_removeChangedID(id) {
if (!this.enabled) if (!this.enabled)
return; return;
this._log.debug("Removing changed ID " + id);
if (this.changedIDs[id]) { if (this.changedIDs[id]) {
delete this.changedIDs[id]; delete this.changedIDs[id];
this.saveChangedIDs(); this.saveChangedIDs();
@ -182,8 +184,7 @@ Tracker.prototype = {
}, },
clearChangedIDs: function T_clearChangedIDs() { clearChangedIDs: function T_clearChangedIDs() {
if (!this.enabled) this._log.debug("Clearing changed ID list");
return;
for (let id in this.changedIDs) { for (let id in this.changedIDs) {
delete this.changedIDs[id]; delete this.changedIDs[id];
} }