summaryrefslogtreecommitdiffstats
path: root/src/egl/main/egllog.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/egl/main/egllog.c')
-rw-r--r--src/egl/main/egllog.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/egl/main/egllog.c b/src/egl/main/egllog.c
index c8307482902..9d7e9302341 100644
--- a/src/egl/main/egllog.c
+++ b/src/egl/main/egllog.c
@@ -44,6 +44,23 @@
#include "egllog.h"
+#ifdef HAVE_ANDROID_PLATFORM
+#define LOG_TAG "EGL-MAIN"
+#include <cutils/log.h>
+
+/* support versions < JellyBean */
+#ifndef ALOGW
+#define ALOGW LOGW
+#endif
+#ifndef ALOGD
+#define ALOGD LOGD
+#endif
+#ifndef ALOGI
+#define ALOGI LOGI
+#endif
+
+#endif /* HAVE_ANDROID_PLATFORM */
+
#define MAXSTRING 1000
#define FALLBACK_LOG_LEVEL _EGL_WARNING
@@ -107,7 +124,26 @@ _eglSetLogProc(_EGLLogProc logger)
static void
_eglDefaultLogger(EGLint level, const char *msg)
{
+#ifdef HAVE_ANDROID_PLATFORM
+ switch (level) {
+ case _EGL_DEBUG:
+ ALOGD("%s", msg);
+ break;
+ case _EGL_INFO:
+ ALOGI("%s", msg);
+ break;
+ case _EGL_WARNING:
+ ALOGW("%s", msg);
+ break;
+ case _EGL_FATAL:
+ LOG_FATAL("%s", msg);
+ break;
+ default:
+ break;
+ }
+#else
fprintf(stderr, "libEGL %s: %s\n", level_strings[level], msg);
+#endif /* HAVE_ANDROID_PLATFORM */
}