Bug 1041181 - Fix repeated GMPInstallManager log lines. r=gfritzsche a=sylvestre
authorBrian R. Bondy <netzen@gmail.com>
Fri, 25 Jul 2014 21:51:41 -0400
changeset 216196 683f69c347f1e284a9bac160b9104bdccb1371ec
parent 216195 9dde3907962cba3d233f352f726402c502299220
child 216197 e7e4f87bf560e816e917973891e4cb90aca99348
push id3857
push userraliiev@mozilla.com
push dateTue, 02 Sep 2014 16:39:23 +0000
treeherdermozilla-beta@5638b907b505 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgfritzsche, sylvestre
bugs1041181
milestone33.0a2
Bug 1041181 - Fix repeated GMPInstallManager log lines. r=gfritzsche a=sylvestre
toolkit/modules/GMPInstallManager.jsm
--- a/toolkit/modules/GMPInstallManager.jsm
+++ b/toolkit/modules/GMPInstallManager.jsm
@@ -25,16 +25,24 @@ Cu.import("resource://gre/modules/Log.js
 Cu.import("resource://gre/modules/osfile.jsm");
 Cu.import("resource://gre/modules/Task.jsm");
 Cu.import("resource://gre/modules/ctypes.jsm");
 
 this.EXPORTED_SYMBOLS = ["GMPInstallManager", "GMPExtractor", "GMPDownloader",
                          "GMPAddon", "GMPPrefs"];
 
 var gLocale = null;
+const PARENT_LOGGER_ID = "GMPInstallManager";
+
+// Setup the parent logger with dump logging. It'll only be used if logging is
+// enabled though.
+let parentLogger = Log.repository.getLogger(PARENT_LOGGER_ID);
+parentLogger.level = Log.Level.Debug;
+let appender = new Log.DumpAppender();
+parentLogger.addAppender(appender);
 
 // Shared code for suppressing bad cert dialogs
 XPCOMUtils.defineLazyGetter(this, "gCertUtils", function() {
   let temp = { };
   Cu.import("resource://gre/modules/CertUtils.jsm", temp);
   return temp;
 });
 
@@ -43,23 +51,18 @@ XPCOMUtils.defineLazyModuleGetter(this, 
 
 // Used to determine if logging should be enabled
 XPCOMUtils.defineLazyGetter(this, "gLogEnabled", function() {
   return GMPPrefs.get(GMPPrefs.KEY_LOG_ENABLED);
 });
 
 
 function getScopedLogger(prefix) {
-  let logger = Log.repository.getLogger(prefix);
-  if (gLogEnabled) {
-    logger.level = Log.Level.Debug;
-    let appender = new Log.DumpAppender();
-    logger.addAppender(appender);
-  }
-  return logger;
+  var parentScope = gLogEnabled ? PARENT_LOGGER_ID + "." : "";
+  return Log.repository.getLogger(parentScope + prefix);
 }
 
 
 /**
  * Manages preferences for GMP addons
  */
 let GMPPrefs = {
   /**