> On Jan 8, 2016, at 5:50 PM, Mike Hommey <m...@glandium.org> wrote: > > On Fri, Jan 08, 2016 at 05:32:48PM -0800, Eric Rahm wrote: >> Hi Folks- >> >> With bug 1233881 <https://bugzilla.mozilla.org/show_bug.cgi?id=1233881> we >> landed the ability turn on logging via prefs. >> >> Lets say you have a log module "Foo", if you add a "logging.Foo" pref and >> set it to "Debug" you will now see all output from the Foo log module that >> is of Debug and higher importance. >> >> Why is this so cool? Well now you don't need to restart your browser to >> enable logging [1]. You also don't have to set env vars to enable logging >> [2]. >> >> There is one caveat: if you don't use LazyLogModule and friends, you don't >> get dynamic logging. So go update your loggers! > > I now wish we had the same for the three or so different logging systems > in use in javascript.
By the way, with Console.jsm you can do something similar: let {ConsoleAPI} = Cu.import("resource://gre/modules/Console.jsm", {}); let console = new ConsoleAPI({ maxLogLevelPref: "myPref.loglevel", }); console.log(“Message”); The UITour code does this, and sets it’s log level pref to “error” by default so only console.error messages will be shown. Then you can flip that pref to “all” or “log” at runtime to enable logging for that module. Brian _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform