anode icon indicating copy to clipboard operation
anode copied to clipboard

Would be convenient if console.log wrote to Android's LOGCAT

Open jackpal opened this issue 12 years ago • 4 comments

It would be convenient if console.log and related functions wrote to Android's LOGCAT by default.

See android/log.h in the NDK.

jackpal avatar Apr 11 '12 00:04 jackpal

Yes, I've been meaning to do this for a while. Obviously a pull request would be great :)

paddybyers avatar Apr 11 '12 22:04 paddybyers

Hmm, I see the problem is that console writes to stdout, which Android black-holes.

So maybe it would be better to provide a separate android log API, and maybe a wrapper that's compatible with console.

How would you go about implementing such a thing?

One way would be to export the Android NDK log APIs as a new node module.

Another way would be to export the Android Java log APIs as a new node module.

Is either of that supported for anode? Are there any examples of Android APIs being exported?

Or is there another way?

jackpal avatar Apr 12 '12 17:04 jackpal

You can redirect stdio to logcat.

$ adb shell stop $ adb shell setprop log.redirect-stdio true $ adb shell start

NomadLibra avatar Jul 10 '12 05:07 NomadLibra

Thanks! On Jul 10, 2012 12:04 PM, "NomadLibra" < [email protected]> wrote:

You can redirect stdio to logcat.

$ adb shell stop $ adb shell setprop log.redirect-stdio true $ adb shell start


Reply to this email directly or view it on GitHub: https://github.com/paddybyers/anode/issues/9#issuecomment-6867075

jackpal avatar Jul 10 '12 06:07 jackpal