mozilla/addon-sdk — pull request #689 by mykmelez (2012-12-15 00:28:27+00:00)
Title: set a default log level and add prefs for changing it

This is a fix for bug [711815](https://bugzilla.mozilla.org/show_bug.cgi?id=711815) that adds a default log level to the plain-text-console module along with a mechanism to change the log level for a specific addon or all SDK-based addons.

The log levels, and the console methods they enable, are:

* all: all methods
* debug: debug(), log(), info(), warn(), error()
* info: log(), info(), warn(), error()
* warn: warn(), error()
* error: error()
* off: no methods

The names of these levels are taken from log4javascript, which is based on [log4j](http://en.wikipedia.org/wiki/Log4j). The default log level for `cfx run` is *info*; the default level for an installed addon is *error*.

The only (cosmetic) change to existing functionality is that warn() messages now get prefixed with *warn* instead of *warning* for consistency with the name of the method and the name of the log level.

I intentionally placed the addon-specific preference inside the *extensions.[id]* namespace, so addons can create a simple pref for it. I also intentionally placed it inside an *sdk* subnamespace, i.e. *extensions.[id].sdk*, to isolate it from an addon's own preferences. This establishes a precedent for other such prefs, should we choose to add some in the future.