/* 
 Copyright 2005-2007 Foxmarks Inc.
 
 foxmarks-log.js: provides logging support.
 
 */

var Xmarks;
if(Xmarks === undefined){
    Xmarks = {};
}

(function() {

Xmarks.LogWrite = function(str) {
    if (Xmarks.gSettings.enableLogging) {
        Components.classes["@foxcloud.com/extensions/foxmarks;1"].
            getService(Components.interfaces.nsIFoxmarksService).logWrite(str);
    }
}

Xmarks.LogTimer = function(str, startTime){
    if(Xmarks.gSettings.getDebugOption("timing")){
        var now = Date.now();
        startTime = startTime || 0;
        if(startTime){
            Xmarks.LogWrite(str +
                " - time=" + (now - startTime ) + "ms");
        } else {
            Xmarks.LogWrite(str + " -  time=0");
        }
        return now;
    }

    return 0;
}

})();
