Chromium Code Reviews| Index: sky/engine/bindings/builtin_natives.cc |
| diff --git a/sky/engine/bindings/builtin_natives.cc b/sky/engine/bindings/builtin_natives.cc |
| index d3d1216e3c6868d3b8e6bf5179599407960f8145..c403b9f1b04d847e458b243c0f0f7b81d3ae7cf7 100644 |
| --- a/sky/engine/bindings/builtin_natives.cc |
| +++ b/sky/engine/bindings/builtin_natives.cc |
| @@ -26,6 +26,10 @@ |
| #include "sky/engine/tonic/dart_value.h" |
| #include "sky/engine/wtf/text/WTFString.h" |
| +#if defined(OS_ANDROID) |
| +#include <android/log.h> |
| +#endif |
| + |
| namespace blink { |
| #define REGISTER_FUNCTION(name, count) \ |
| @@ -159,14 +163,16 @@ void Logger_PrintString(Dart_NativeArguments args) { |
| if (Dart_IsError(result)) { |
| Dart_PropagateError(result); |
| } else { |
| - |
| - String message(chars, length); |
| - // TODO(dart): Hook up to developer console (if/when that's a thing). |
| -#if OS(ANDROID) || OS(IOS) |
| - LOG(INFO) << "CONSOLE: " << message.utf8().data(); |
| -#else |
| - printf("CONSOLE: %s\n", message.utf8().data()); |
| - fflush(stdout); |
| + // 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. |
|
abarth-chromium
2015/07/16 14:17:55
Please remove this sentence about the "chromium" t
ppi
2015/07/16 16:18:47
Done.
|
| + __android_log_print(ANDROID_LOG_INFO, "chromium", "%.*s", length, chars); |
|
abarth-chromium
2015/07/16 14:17:55
s/chromium/sky/
ppi
2015/07/16 16:18:47
Done.
|
| #endif |
| } |
| } |