]> git.cworth.org Git - apitrace/blobdiff - common/os_posix.cpp
Add support for android logging to logcat
[apitrace] / common / os_posix.cpp
index 3eebbd862d4a78448b062a11ba10ce1232d8fcb8..ebd59a097076d05fe6b3eadf4c2ffae57a78547d 100644 (file)
 #include <mach-o/dyld.h>
 #endif
 
+#ifdef ANDROID
+#include <android/log.h>
+#endif
+
 #ifndef PATH_MAX
 #warning PATH_MAX undefined
 #define PATH_MAX 4096
@@ -153,7 +157,11 @@ log(const char *format, ...)
     va_list ap;
     va_start(ap, format);
     fflush(stdout);
+#ifdef ANDROID
+    __android_log_vprint(ANDROID_LOG_DEBUG, "apitrace", format, ap);
+#else
     vfprintf(stderr, format, ap);
+#endif
     va_end(ap);
     logging = false;
 }