diff options
author | Zhaowei Yuan <zhaowei.yuan@samsung.com> | 2019-05-06 13:52:32 +0800 |
---|---|---|
committer | SooChan Lim <sc1.lim@samsung.com> | 2019-05-07 06:39:10 +0000 |
commit | 8854eef9eb4718b0145d639b1bf37c610a910632 (patch) | |
tree | 4712c8a729ae7734050906c70a6ede8d607e963b /src | |
parent | b0dec10d0d0fbc7f77623016f3d986122f718f8b (diff) | |
download | mesa-8854eef9eb4718b0145d639b1bf37c610a910632.tar.gz mesa-8854eef9eb4718b0145d639b1bf37c610a910632.tar.bz2 mesa-8854eef9eb4718b0145d639b1bf37c610a910632.zip |
Re-implement _eglLog based on dlog
_eglLog is a basic log function for mesa, re-implement
it based on dlog here for debug purpose.
Log level can be changed by setting environment variable
EGL_LOG_LEVEL.
Change-Id: Ib356d14d631fcda0d9c45f0e442f02981b0377be
Signed-off-by: Zhaowei Yuan <zhaowei.yuan@samsung.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/egl/main/egllog.c | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/src/egl/main/egllog.c b/src/egl/main/egllog.c index c223f49b0fe..de4bee26c0e 100644 --- a/src/egl/main/egllog.c +++ b/src/egl/main/egllog.c @@ -44,6 +44,10 @@ #include "util/macros.h" #include "egllog.h" +#ifdef HAVE_TIZEN_PLATFORM +#define LOG_TAG "MESA" +#include <dlog.h> +#endif #ifdef HAVE_ANDROID_PLATFORM #define LOG_TAG "EGL-MAIN" @@ -56,7 +60,7 @@ #endif /* HAVE_ANDROID_PLATFORM */ #define MAXSTRING 1000 -#define FALLBACK_LOG_LEVEL _EGL_WARNING +#define FALLBACK_LOG_LEVEL _EGL_FATAL static struct { @@ -78,6 +82,7 @@ static const char *level_strings[] = { }; +#ifndef HAVE_TIZEN_PLATFORM /** * The default logger. It prints the message to stderr. */ @@ -96,6 +101,7 @@ _eglDefaultLogger(EGLint level, const char *msg) fprintf(stderr, "libEGL %s: %s\n", level_strings[level], msg); #endif /* HAVE_ANDROID_PLATFORM */ } +#endif /** @@ -153,13 +159,40 @@ _eglLog(EGLint level, const char *fmtStr, ...) mtx_lock(&logging.mutex); +#ifdef HAVE_TIZEN_PLATFORM + log_priority dlog_prio; + + switch (level) { + case _EGL_FATAL: + dlog_prio = DLOG_ERROR; + break; + case _EGL_WARNING: + dlog_prio = DLOG_WARN; + break; + case _EGL_INFO: + dlog_prio = DLOG_INFO; + break; + case _EGL_DEBUG: + dlog_prio = DLOG_DEBUG; + break; + default: + return; + } +#endif + va_start(args, fmtStr); +#ifdef HAVE_TIZEN_PLATFORM + __dlog_vprint(LOG_ID_SYSTEM, dlog_prio, LOG_TAG, fmtStr, args); +#else ret = vsnprintf(msg, MAXSTRING, fmtStr, args); if (ret < 0 || ret >= MAXSTRING) strcpy(msg, "<message truncated>"); +#endif va_end(args); +#ifndef HAVE_TIZEN_PLATFORM _eglDefaultLogger(level, msg); +#endif mtx_unlock(&logging.mutex); |