Stop calling _android_log_print/write() directly to output log messages

RESOLVED DUPLICATE of bug 881389

Status

RESOLVED DUPLICATE of bug 881389
4 years ago
4 years ago

People

(Reporter: cyu, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Search "__android_log_" for *.h and *.c* in gecko and you will find more than 400 matches. When some module wants to output a log message on b2g, normally it will do:

#ifdef MOZ_WIDGET_GONK
#include <android/log.h>
#endif

and then
#ifdef MOZ_WIDGET_GONK
__android_log_write(ANDROID_LOG_INFO, SOME_TAG, cstr);
#endif

The good part of doing this is:
* The log will surely be seen in android logcat.
* Android log API has severity and tag, allowing the log viewer to filter log messages.

The bad part of it is:
* We litter throughout our code base with the above code snippets, probably because of copy and paste.
* The log messages are only available on emulator and device. B2G desktop won't see the messages.

Some alternatives to __android_log_print/write() calls:
1. printf_stderr()
2. PR_LOG()
3. just printf() and redirect stdout and stderr to some self-pipe. Then we can decide where to output these messages.
(Reporter)

Comment 1

4 years ago
Dupe to bug 881389, which tracks the work to unify logging in b2g.
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 881389
You need to log in before you can comment on or make changes to this bug.