Closed Bug 1046156 Opened 10 years ago Closed 10 years ago

"bind" entire AndroidLog module to a tag

Categories

(Firefox for Android Graveyard :: General, enhancement)

All
Android
enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 34

People

(Reporter: myk, Assigned: myk)

Details

Attachments

(1 file)

It'd be handy to be able to "bind" the entire AndroidLog module to a tag, so you don't have to specify a tag each time you call one of its functions:

  let Log = Cu.import("resource://gre/modules/AndroidLog.jsm", {}).AndroidLog.bind("MyModule");
  Log.d("This is a debug message.");
  // Outputs "D/GeckoMyModule(#####): This is a debug message."

The "bind" function isn't Function.bind, as this is an object, not a function.  But it does for the object what Function.bind does for its individual functions.  So I figured it would make sense.  Commence bikeshedding at your leisure!

(I once implemented a preferences API that let you access prefs via both a root Prefs object and Prefs("branch") instances, which is roughly equivalent to what this provides; but that API was a bit subtle, too clever; this one seems better.)
Attachment #8464727 - Flags: review?(mark.finkle)
Comment on attachment 8464727 [details] [diff] [review]
patch v1: "bind" entire AndroidLog module

nice
Attachment #8464727 - Flags: review?(mark.finkle) → review+
https://hg.mozilla.org/mozilla-central/rev/2cc8ef816748
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → Firefox 34
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: