Closed Bug 970208 Opened 11 years ago Closed 11 years ago

make WebappManager.jsm output debug statements only if MOZ_DEBUG is set

Categories

(Firefox for Android Graveyard :: Web Apps (PWAs), defect, P3)

ARM
Android
defect

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 30

People

(Reporter: myk, Assigned: mhaigh)

References

Details

Attachments

(1 file, 5 obsolete files)

Webapps.jsm only outputs debug statements to the console if MOZ_DEBUG is set, which makes console output cleaner in optimized builds while still enabling developers to see debugging messages in debug builds. WebappManager.jsm should do the same. Notwithstanding the recent change from "dump" to "log" in that file, if we're going to restrict logging to MOZ_DEBUG, then we should probably call it "debug", as we do in Webapps.jsm, making it something like: function debug(aMessage) { #ifdef MOZ_DEBUG dump(aMessage); #endif } Note that we don't need to append a newline character to the message because WebappManager.jsm is Android-only, and Android automagically separates logcat entries with newlines.
Priority: -- → P3
Assignee: nobody → mhaigh
Attachment #8374029 - Flags: review?(wjohnston)
Comment on attachment 8374029 [details] [diff] [review] Only print debug messages when in debug mode You'll also need to modify mobile/android/modules/moz.build to add WebappManager.jsm to EXTRA_PP_JS_MODULES instead of EXTRA_JS_MODULES so it gets preprocessed.
updated code based on feedback
Attachment #8374029 - Attachment is obsolete: true
Attachment #8374029 - Flags: review?(wjohnston)
Attachment #8374157 - Flags: feedback?(myk)
Comment on attachment 8374157 [details] [diff] [review] Only print debug messages when in debug mode Review of attachment 8374157 [details] [diff] [review]: ----------------------------------------------------------------- Looks good, although I'd prefer we rename this to *debug* (despite the additional changes that would require). ::: mobile/android/modules/WebappManager.jsm @@ +33,5 @@ > // have the INFO level of severity instead of the ERROR level. And we don't > // append a newline character to the end of the message because *dump* spills > // into the Android native logging system, which strips newlines from messages > // and breaks messages into lines automatically at display time (i.e. logcat). > +#ifdef MOZ_DEBUG Nit: trailing whitespace.
Attachment #8374157 - Flags: review?(wjohnston)
Attachment #8374157 - Flags: feedback?(myk)
Attachment #8374157 - Flags: feedback+
Changed log to debug
Attachment #8374157 - Attachment is obsolete: true
Attachment #8374157 - Flags: review?(wjohnston)
Attachment #8374765 - Flags: feedback?(myk)
Oops - forgot to address nits!
Attachment #8374765 - Attachment is obsolete: true
Attachment #8374765 - Flags: feedback?(myk)
Attachment #8374768 - Flags: feedback?(myk)
Comment on attachment 8374768 [details] [diff] [review] Only print debug messages when in debug mode Review of attachment 8374768 [details] [diff] [review]: ----------------------------------------------------------------- This is missing the change to mobile/android/modules/moz.build again! ::: mobile/android/modules/WebappManager.jsm @@ +33,5 @@ > // have the INFO level of severity instead of the ERROR level. And we don't > // append a newline character to the end of the message because *dump* spills > // into the Android native logging system, which strips newlines from messages > // and breaks messages into lines automatically at display time (i.e. logcat). > +#ifdef MOZ_DEBUG Nit: trailing whitespace.
Attachment #8374768 - Flags: feedback?(myk) → feedback-
Added back moz build file. Don't know how that one slipped through the gaps!
Attachment #8374768 - Attachment is obsolete: true
Attachment #8377150 - Flags: feedback?(myk)
...and fixed the nit too!
Attachment #8377150 - Attachment is obsolete: true
Attachment #8377150 - Flags: feedback?(myk)
Attachment #8377157 - Flags: feedback?(myk)
Comment on attachment 8377157 [details] [diff] [review] Only print debug messages when in debug mode Review of attachment 8377157 [details] [diff] [review]: ----------------------------------------------------------------- Looks good!
Attachment #8377157 - Flags: review?(wjohnston)
Attachment #8377157 - Flags: feedback?(myk)
Attachment #8377157 - Flags: feedback+
Comment on attachment 8377157 [details] [diff] [review] Only print debug messages when in debug mode Review of attachment 8377157 [details] [diff] [review]: ----------------------------------------------------------------- To be honest, I prefer hiding these behind prefs so that web/app-developers/QA can turn it on/off. But I'll let you guys make that call.
Attachment #8377157 - Flags: review?(wjohnston) → review+
(In reply to Wesley Johnston (:wesj) from comment #11) > To be honest, I prefer hiding these behind prefs so that > web/app-developers/QA can turn it on/off. But I'll let you guys make that > call. Ideally we'd simply log messages with a level (debug, warning, error, etc.) and then let the system/user decide which messages to write to log files or display. Perhaps such a facility already exists in Fennec? In the meantime, I've pushed this patch to inbound and filed bug 979907 on logging messages with a level. Let's follow up on better logging in that bug. https://hg.mozilla.org/integration/mozilla-inbound/rev/799bd9fbd045
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 30
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: