From daffb2c5870b319c5e1cb3f70bb9292e746e0efe Mon Sep 17 00:00:00 2001 From: Doug Turner Date: Mon, 14 Nov 2011 19:12:20 -0800 Subject: [PATCH] Bug 702029 - Push all console logging to androids adb logcat. r=blassey --- xpcom/base/nsConsoleService.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/xpcom/base/nsConsoleService.cpp b/xpcom/base/nsConsoleService.cpp index 7ca5144775e..0d29a773358 100644 --- a/xpcom/base/nsConsoleService.cpp +++ b/xpcom/base/nsConsoleService.cpp @@ -53,6 +53,10 @@ #include "nsConsoleMessage.h" #include "nsIClassInfoImpl.h" +#if defined(ANDROID) +#include +#endif + using namespace mozilla; NS_IMPL_THREADSAFE_ADDREF(nsConsoleService) @@ -135,6 +139,16 @@ nsConsoleService::LogMessage(nsIConsoleMessage *message) { MutexAutoLock lock(mLock); +#if defined(ANDROID) + { + nsXPIDLString msg; + message->GetMessageMoz(getter_Copies(msg)); + __android_log_print(ANDROID_LOG_ERROR, "Gecko *** Console Service *** ", + "%s", + NS_LossyConvertUTF16toASCII(msg).get()); + } +#endif + /* * If there's already a message in the slot we're about to replace, * we've wrapped around, and we need to release the old message. We