From f18b9dafbcc37110c3ed9c0a6da71f1fbd9129b1 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 --- src/node_errors.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/node_errors.cc b/src/node_errors.cc index d3a409b1ab455a..4fe7edea8a8886 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; @@ -413,6 +417,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