166 bytes, text/html
One of the most common reasons I'm withholding full review from Jetpack add-ons lately is that they tend to produce large amounts of debugging Error Console output. I think that a prominent API with builtin consideration for debugging flags would go a long way towards making authors conscious of the need to stem their debugging output in release versions. The flag should probably be stored as a preference which defaults to false. As to how authors should enable it in their own builds and setups, I have no idea.
There actually are already a bunch of methods on the console object: https://addons.mozilla.org/en-US/developers/docs/sdk/1.3/dev-guide/addon-development/console.html including a console.debug(). I think that might only do stuff in actual debug builds of Firefox, though.
If the debug method suits the purposes of this bug then a documentation update might be sufficient. I think, given the complexity of the console API, that a parallel 'debug' object with the same message might be a better route. I.e., debug.log(), debug.trace()
The conventional solution to this problem is to specify a default log level for production environments that is stricter than that for testing environments. For example, testing environments might log all messages that are at the "info" level of severity or higher by default, while production environments log all messages that are at the "warn" or "error" level of severity. The Jetpack console object supports the following four levels of severity and corresponding methods for logging at those levels: * debug: debug() * info: info(), log() * warning: warn() * error: error() We should set the default log level to "info" for testing environments, i.e. when running automated tests for an addon via `cfx test` and testing the addon manually via `cfx run`; and "error" for production environments, i.e. when using an addon by installing it from a package created by `cfx xpi`. We should also allow users to specify a log level, so developers can choose to see "debug" messages while debugging their addons and users can choose to see less severe messages while gathering information to report a bug. But that can be done in a separate bug.
Comment on attachment 692503 [details] pull request 689 - set a default log level and add prefs for changing it That's really cool Myk, thanks!! Could you please hold on landing it though, tree is orange now, I'll land this as soon as we'll make it green again.
Sure thing, I'll let you land it at your convenience!
Commit pushed to master at https://github.com/mozilla/addon-sdk https://github.com/mozilla/addon-sdk/commit/fb6b4a92f7969090acd766fe24b8237aa7805ec5 fix Bug 711815 - set a default log level and add prefs for changing it r=@gozala
Commit pushed to integration at https://github.com/mozilla/addon-sdk https://github.com/mozilla/addon-sdk/commit/fb6b4a92f7969090acd766fe24b8237aa7805ec5 fix Bug 711815 - set a default log level and add prefs for changing it r=@gozala