Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1447)

Unified Diff: sky/engine/bindings/builtin_natives.cc

Issue 1237403002: Cut the spam in sky log printouts. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Address Adam's comments. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..4fe71c3616d1e0b137b3188adfaedc3a30dd5c98 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,13 @@ 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.
+ __android_log_print(ANDROID_LOG_INFO, "sky", "%.*s", length, chars);
#endif
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698