From 9ab32cbeae0e1a8cf0a7907686f6091b8a980256 Mon Sep 17 00:00:00 2001 From: Joonbum Ko Date: Fri, 13 Aug 2021 10:53:02 +0900 Subject: [PATCH] wayland-egl-tizen: Add a log output option. Change-Id: I732410110ece931eb036b4398a45b8be143e36e4 Signed-off-by: Joonbum Ko --- src/wayland-egl-tizen/wayland-egl-tizen.c | 30 ++++++++++++++++++----- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/wayland-egl-tizen/wayland-egl-tizen.c b/src/wayland-egl-tizen/wayland-egl-tizen.c index ff16603..bec3e92 100644 --- a/src/wayland-egl-tizen/wayland-egl-tizen.c +++ b/src/wayland-egl-tizen/wayland-egl-tizen.c @@ -10,16 +10,34 @@ #include #include -#define LOG_TAG "WL_EGL" -#include - #define FONT_DEFAULT "\033[0m" /* for reset to default color */ #define FONT_RED "\033[31m" /* for error logs */ #define FONT_YELLOW "\033[33m" /* for warning logs */ +#define BG_COLOR_GREEN "\033[0;42m" + +#ifdef DLOG_DEFAULT_ENABLE +#define LOG_TAG "WL_EGL" +#include + +#define wl_egl_log_i(t, f, x...) LOGI(BG_COLOR_GREEN t FONT_DEFAULT " " f, ##x) +#define wl_egl_log_e(t, f, x...) LOGE(FONT_RED t " " f FONT_DEFAULT, ##x) +#define wl_egl_log_w(t, f, x...) LOGW(FONT_YELLOW t " " f FONT_DEFAULT, ##x) +#else /* DLOG_DEFAULT_ENABLE */ +#define wl_egl_log_i(t, f, x...) \ + fprintf(stderr, BG_COLOR_GREEN t FONT_DEFAULT "[(tid:%li)(%s)]" f "\n", \ + syscall(SYS_gettid), __func__, ##x) +#define wl_egl_log_e(t, f, x...) \ + fprintf(stderr, FONT_RED t "[(tid:%li)(%s)] " f FONT_DEFAULT "\n", \ + syscall(SYS_gettid), __func__, ##x) +#define wl_egl_log_w(t, f, x...) \ + fprintf(stderr, FONT_YELLOW t "[(tid:%li)(%s)] " f FONT_DEFAULT "\n",\ + syscall(SYS_gettid), __func__, ##x) +#endif /* DLOG_DEFAULT_ENABLE */ + +#define WL_EGL_LOG(f, x...) wl_egl_log_i("[INFO]", f, ##x) +#define WL_EGL_ERR(f, x...) wl_egl_log_e("[ERROR]", f, ##x) +#define WL_EGL_WARN(f, x...) wl_egl_log_w("[WARN]", f, ##x) -#define WL_EGL_LOG(f, x...) LOGI(f, ##x) -#define WL_EGL_ERR(f, x...) LOGE(FONT_RED f FONT_DEFAULT, ##x) -#define WL_EGL_WARN(f, x...) LOGW(FONT_YELLOW f FONT_DEFAULT, ##x) static int _wl_egl_tizen_magic_check(struct tizen_private *private) -- 2.34.1