From add17b19f4a6c53503ad57028b2d8d733147aabd Mon Sep 17 00:00:00 2001 From: Giovanni Campagna Date: Sun, 24 Sep 2017 16:13:45 -0700 Subject: [PATCH] build: on Android, use android log library to print stack traces And other errors like lost promises PR-URL: https://github.com/nodejs/node/pull/29388 Reviewed-By: Ben Noordhuis Reviewed-By: Christian Clauss Reviewed-By: Benjamin Gruenbaum Reviewed-By: Rich Trott --- src/node_errors.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/node_errors.cc b/src/node_errors.cc index e094fe4681fc56..b86ccc3062191a 100644 --- a/src/node_errors.cc +++ b/src/node_errors.cc @@ -10,6 +10,10 @@ #include "node_v8_platform-inl.h" #include "util-inl.h" +#ifdef __ANDROID__ +#include +#endif + namespace node { using errors::TryCatchScope; @@ -426,6 +430,8 @@ void PrintErrorString(const char* format, ...) { // Don't include the null character in the output CHECK_GT(n, 0); WriteConsoleW(stderr_handle, wbuf.data(), n - 1, nullptr, nullptr); +#elif defined(__ANDROID__) + __android_log_vprint(ANDROID_LOG_ERROR, "nodejs", format, ap); #else vfprintf(stderr, format, ap); #endif