From dc1c7323e6e4c9ee1cd28f8cbd4d35a807666ac7 Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 17 Jun 2016 13:52:48 +0200 Subject: [PATCH] Direct log output to __android_log_print --- renderdoc/os/posix/android/android_stringio.cpp | 16 ++++++++++++++++ renderdoc/os/posix/linux/linux_stringio.cpp | 11 +++++++++++ renderdoc/os/posix/posix_stringio.cpp | 11 ----------- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/renderdoc/os/posix/android/android_stringio.cpp b/renderdoc/os/posix/android/android_stringio.cpp index d442c2bcb..a9df50f24 100644 --- a/renderdoc/os/posix/android/android_stringio.cpp +++ b/renderdoc/os/posix/android/android_stringio.cpp @@ -22,8 +22,11 @@ * THE SOFTWARE. ******************************************************************************/ +#include #include "os/os_specific.h" +#define LOGCAT_TAG "renderdoc" + typedef int Display; namespace Keyboard @@ -79,3 +82,16 @@ string Wide2UTF8(const std::wstring &s) return ""; } }; + +namespace OSUtility +{ +void WriteOutput(int channel, const char *str) +{ + if(channel == OSUtility::Output_StdOut) + fprintf(stdout, "%s", str); + else if(channel == OSUtility::Output_StdErr) + fprintf(stderr, "%s", str); + else if(channel == OSUtility::Output_DebugMon) + __android_log_print(ANDROID_LOG_INFO, LOGCAT_TAG, "%s", str); +} +}; diff --git a/renderdoc/os/posix/linux/linux_stringio.cpp b/renderdoc/os/posix/linux/linux_stringio.cpp index b338aaf7a..acff0e5f8 100644 --- a/renderdoc/os/posix/linux/linux_stringio.cpp +++ b/renderdoc/os/posix/linux/linux_stringio.cpp @@ -218,3 +218,14 @@ string Wide2UTF8(const std::wstring &s) return string(&charBuffer[0]); } }; + +namespace OSUtility +{ +void WriteOutput(int channel, const char *str) +{ + if(channel == OSUtility::Output_StdOut) + fprintf(stdout, "%s", str); + else if(channel == OSUtility::Output_StdErr) + fprintf(stderr, "%s", str); +} +}; diff --git a/renderdoc/os/posix/posix_stringio.cpp b/renderdoc/os/posix/posix_stringio.cpp index 692501d97..fc56f9208 100644 --- a/renderdoc/os/posix/posix_stringio.cpp +++ b/renderdoc/os/posix/posix_stringio.cpp @@ -314,14 +314,3 @@ string Fmt(const char *format, ...) return ret; } }; - -namespace OSUtility -{ -void WriteOutput(int channel, const char *str) -{ - if(channel == OSUtility::Output_StdOut) - fprintf(stdout, "%s", str); - else if(channel == OSUtility::Output_StdErr) - fprintf(stderr, "%s", str); -} -};