Bug 599928 - Need a single pref to toggle logging [r=mconnor]

This commit is contained in:
Mark Finkle 2010-10-11 12:46:53 -04:00
parent 64852ef56f
commit 61d949b838

View File

@ -357,22 +357,26 @@ WeaveSvc.prototype = {
dapp.level = Log4Moz.Level[Svc.Prefs.get("log.appender.dump")];
root.addAppender(dapp);
let verbose = Svc.Directory.get("ProfD", Ci.nsIFile);
verbose.QueryInterface(Ci.nsILocalFile);
verbose.append("weave");
verbose.append("logs");
verbose.append("verbose-log.txt");
if (!verbose.exists())
verbose.create(verbose.NORMAL_FILE_TYPE, PERMS_FILE);
let maxSize = 65536; // 64 * 1024 (64KB)
this._debugApp = new Log4Moz.RotatingFileAppender(verbose, formatter, maxSize);
this._debugApp.level = Log4Moz.Level[Svc.Prefs.get("log.appender.debugLog")];
root.addAppender(this._debugApp);
let enabled = Svc.Prefs.get("log.appender.debugLog.enabled", false);
if (enabled) {
let verbose = Svc.Directory.get("ProfD", Ci.nsIFile);
verbose.QueryInterface(Ci.nsILocalFile);
verbose.append("weave");
verbose.append("logs");
verbose.append("verbose-log.txt");
if (!verbose.exists())
verbose.create(verbose.NORMAL_FILE_TYPE, PERMS_FILE);
let maxSize = 65536; // 64 * 1024 (64KB)
this._debugApp = new Log4Moz.RotatingFileAppender(verbose, formatter, maxSize);
this._debugApp.level = Log4Moz.Level[Svc.Prefs.get("log.appender.debugLog")];
root.addAppender(this._debugApp);
}
},
clearLogs: function WeaveSvc_clearLogs() {
this._debugApp.clear();
if (this._debugApp)
this._debugApp.clear();
},
/**