Closed Bug 723354 Opened 13 years ago Closed 6 years ago

[Gonk] Add more powerful adb logging functionality to privileged JS environments

Categories

(Core :: General, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: philikon, Unassigned)

Details

With the Gonk widget backend enabled, the dump() function goes to logcat with the "Gecko" tag and the ANDROID_LOG_INFO loglevel. I think that's fine for Android where Gecko/Fennec is just one app out of many. On B2G, however, Gecko provides a bunch of system-level services (radio, WiFi, networking, etc.). Each of these should get their own log tag and be able to emit log messages at different levels. That way we don't have to reinvent a logging mechanism inside those services. Right now we do a lot of `if (DEBUG)` checks which is pretty ghetto and not very flexible... It means when something goes wrong you need to flip the DEBUG flag, rebuild, and then be able to reproduce it exactly to get the logs. In C++ contexts, code can already use __android_log_print(tag, level, ...). But most of the stuff mentioned above is implemented as JS-XPCOM components and ChromeWorkers. It would be very elegant if we could use the `console` object to log directly to adb, with the appropriate log level (console.info, console.trace, etc.). Alternatively, we could keep it simple and add a stupid function like akin to __android_log_print() to those environments. (But then we'd also have to define the adb log levels which is a bit tedious.)
Let's get console-->logcat for JS. C++ already has NSPR logging with all that functionality, which should be redirected to logcat already. It may not be, I haven't checked recently.
(In reply to Chris Jones [:cjones] [:warhammer] from comment #1) > Let's get console-->logcat for JS. I'm working on this on a very simplistic level in bug 723356: JS console output will go to the console service which will log to adb under the GeckoConsole tag with the info level. We really want chrome-privileged JS environments to be able to define their own log tags, and the adb log levels should correspond to the `console` methods that are invoked (e.g. console.info() corresponds to ANDROID_LOG_INFO, etc.). Maybe something like console.mozTag = "RIL";
CCing robcee for opinions.
What sort of context is your "window" object in? These are probably going to be system level or chrome window objects, right? These types of window.console objects aren't well-defined at the moment and should probably just dump to nsIConsoleService anyway.
Closing as we are not working on Firefox OS anymore.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.