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

Unified Diff: mojo/dart/embedder/builtin_natives.cc

Issue 1239583004: Cut the spam in the dart handler log printouts. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Address Ben'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: mojo/dart/embedder/builtin_natives.cc
diff --git a/mojo/dart/embedder/builtin_natives.cc b/mojo/dart/embedder/builtin_natives.cc
index 745c1887322c1d8f432b0586ce79cb0c792b5238..4a8ce6efd1a7811ecbfa2fda3231b58da3c54187 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,17 @@ 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.
+ __android_log_print(ANDROID_LOG_INFO, "chromium", "%.*s", length, chars);
#endif
}
fflush(stdout);
« 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