From 2e41280ae9aec74ad2c9ca4c64ca521d14c6d4f6 Mon Sep 17 00:00:00 2001 From: Jarvis Huang Date: Sun, 29 Oct 2023 22:39:21 +0800 Subject: [PATCH] st/oxr: Route log output to Android logcat --- src/xrt/state_trackers/oxr/oxr_logger.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/xrt/state_trackers/oxr/oxr_logger.c b/src/xrt/state_trackers/oxr/oxr_logger.c index 0659318ec..0c55d6125 100644 --- a/src/xrt/state_trackers/oxr/oxr_logger.c +++ b/src/xrt/state_trackers/oxr/oxr_logger.c @@ -22,6 +22,10 @@ #include #include +#ifdef XRT_OS_ANDROID +#include +#endif + #define LOG_BUFFER_SIZE (1024) @@ -91,9 +95,14 @@ print_prefix(struct oxr_logger *logger, const char *fmt, const char *prefix, cha static void do_output(const char *buf) { -#ifdef XRT_OS_WINDOWS +#if defined(XRT_OS_WINDOWS) OutputDebugStringA(buf); + if (debug_get_bool_option_no_printing_stderr()) { + return; + } +#elif defined(XRT_OS_ANDROID) + __android_log_write(ANDROID_LOG_DEBUG, "OXR", buf); if (debug_get_bool_option_no_printing_stderr()) { return; }