Chromium Code Reviews| Index: mojo/dart/embedder/builtin_natives.cc |
| diff --git a/mojo/dart/embedder/builtin_natives.cc b/mojo/dart/embedder/builtin_natives.cc |
| index 745c1887322c1d8f432b0586ce79cb0c792b5238..dada021f2a3af933098a90566209086993dff74c 100644 |
| --- a/mojo/dart/embedder/builtin_natives.cc |
| +++ b/mojo/dart/embedder/builtin_natives.cc |
| @@ -17,6 +17,10 @@ |
| #include "mojo/dart/embedder/builtin.h" |
| #include "mojo/dart/embedder/mojo_natives.h" |
| +#if defined(OS_ANDROID) |
| +#include <android/log.h> |
| +#endif |
| + |
| namespace mojo { |
| namespace dart { |
| @@ -80,14 +84,19 @@ void Logger_PrintString(Dart_NativeArguments args) { |
| if (Dart_IsError(result)) { |
| Dart_PropagateError(result); |
| } else { |
| - // TODO(dart): Hook up to developer console (if/when that's a thing). |
| -#if defined(OS_ANDROID) |
| - std::string message(reinterpret_cast<char*>(chars), length); |
| - LOG(INFO) << "CONSOLE: " << message; |
| -#else |
| + // TODO(dart): Hook up to developer console (if/when that's a thing). |
| // Uses fwrite to support printing NUL bytes. |
| fwrite(chars, 1, length, stdout); |
| fputs("\n", stdout); |
| +#if defined(OS_ANDROID) |
| + // In addition to writing to the stdout, write to the logcat so that the |
| + // message is discoverable when running on an unrooted device. Use the |
| + // "chromium" tag to match native printouts produced by base LOG macros, so |
| + // that the same rule will pick them up in scripts that stream relevant |
| + // logcat output to host terminal. |
| + std::string str_newline = std::string(reinterpret_cast<const char*>(chars), |
| + length) + "\n"; |
| + __android_log_print(ANDROID_LOG_INFO, "chromium", str_newline.c_str()); |
|
qsr
2015/07/16 08:31:39
Do android_log_print needs a carriage return? From
ppi
2015/07/16 09:41:27
Yes indeed, done.
|
| #endif |
| } |
| fflush(stdout); |