Mobillians!

I just landed bug 1004825, which adds prioritized, tagged logging to the JavaScript code in Fennec with an API that resembles android.util.Log.

https://bugzilla.mozilla.org/show_bug.cgi?id=1004825

To use it, import the module and then call its v, d, i, w, or e functions:

let Log = Cu.import("resource://gre/modules/AndroidLog.jsm", {}).AndroidLog;
Log.v("MyModule", "This is a verbose message.");
Log.d("MyModule", "This is a debug message.");
Log.i("MyModule", "This is an info message.");
Log.w("MyModule", "This is a warning message.");
Log.e("MyModule", "This is an error message.");

And bind Log.d with a tag to replace bespoke dump/log/debug functions:

let debug = Log.d.bind(null, "MyModule");
debug("This is a debug message with a MyModule tag.");

Tags automatically have "Gecko" prepended to them, and I've replaced the dump function in browser.js with a Log.d binding, so its messages are now logged at the debug level and with the GeckoBrowser tag.

See the module source for more docs!

http://mxr.mozilla.org/mozilla-central/source/mobile/android/modules/AndroidLog.jsm

-myk

_______________________________________________
mobile-firefox-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/mobile-firefox-dev

Reply via email to