bug 1523104: remote: add Log.verbose; r=ochameau
authorAndreas Tolfsen <ato@sny.no>
Thu, 07 Mar 2019 22:09:06 +0000
changeset 521128 d9cce6c1e153
parent 521127 06c54b40f312
child 521129 0fa4b12c2f35
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersochameau
bugs1523104
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 1523104: remote: add Log.verbose; r=ochameau
remote/Log.jsm
--- a/remote/Log.jsm
+++ b/remote/Log.jsm
@@ -1,20 +1,28 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 var EXPORTED_SYMBOLS = ["Log"];
 
+const {Preferences} = ChromeUtils.import("resource://gre/modules/Preferences.jsm");
+const {Log: StdLog} = ChromeUtils.import("resource://gre/modules/Log.jsm");
+
+const LOG_LEVEL = "remote.log.level";
+
 /** E10s compatible wrapper for the standard logger from Log.jsm. */
 class Log {
   static get() {
-    const StdLog = ChromeUtils.import("resource://gre/modules/Log.jsm").Log;
     const logger = StdLog.repository.getLogger("RemoteAgent");
     if (logger.ownAppenders.length == 0) {
       logger.addAppender(new StdLog.DumpAppender());
-      logger.manageLevelFromPref("remote.log.level");
+      logger.manageLevelFromPref(LOG_LEVEL);
     }
     return logger;
   }
+
+  static get verbose() {
+    return StdLog.Level[Preferences.get(LOG_LEVEL)] >= StdLog.Level.Info;
+  }
 }