Closed Bug 1062193 Opened 10 years ago Closed 10 years ago

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

Categories

(Firefox OS Graveyard :: General, defect)

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 881389

People

(Reporter: cyu, Unassigned)

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.
Dupe to bug 881389, which tracks the work to unify logging in b2g.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.