Skip to content

Commit

Permalink
build: on Android, use android log library to print stack traces
Browse files Browse the repository at this point in the history
And other errors like lost promises

PR-URL: #29388
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Christian Clauss <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • Loading branch information
gcampax authored and MylesBorins committed Dec 13, 2019
1 parent d1c4fcc commit d90815d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/node_errors.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
#include "node_v8_platform-inl.h"
#include "util-inl.h"

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

namespace node {

using errors::TryCatchScope;
Expand Down Expand Up @@ -429,6 +433,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
Expand Down

0 comments on commit d90815d

Please sign in to comment.