From b768f5804e56f10935b727cd401b31b9157cee58 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Tue, 21 Jun 2016 11:20:40 +0900 Subject: [PATCH] Use dlog logging system Change-Id: I672ac678bce625a26af1c718bf57c70e41fef7c4 --- src/tbm_bufmgr.c | 2 +- src/tbm_bufmgr_int.h | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/tbm_bufmgr.c b/src/tbm_bufmgr.c index a060584..725c395 100644 --- a/src/tbm_bufmgr.c +++ b/src/tbm_bufmgr.c @@ -496,7 +496,7 @@ tbm_bufmgr_init(int fd) bDlog = atoi(env); TBM_LOG_D("TBM_DLOG=%s\n", env); } else { - bDlog = 0; + bDlog = 1; } #endif diff --git a/src/tbm_bufmgr_int.h b/src/tbm_bufmgr_int.h index 6275005..77a29a9 100644 --- a/src/tbm_bufmgr_int.h +++ b/src/tbm_bufmgr_int.h @@ -108,14 +108,22 @@ extern int bDlog; fprintf(stderr, "[TBM:E(%d)(%s:%d)] " fmt, getpid(), __func__, __LINE__, ##__VA_ARGS__);\ } \ } + +#define TBM_DEBUG(fmt, ...) {\ + if (bDlog) {\ + LOGD("[TBM_DEBUG] " fmt, ##__VA_ARGS__);\ + } \ + else {\ + fprintf(stderr, "[TBM:DEBUG(%d)] " fmt, getpid(), ##__VA_ARGS__);\ + } \ +} #else #define TBM_LOG_D(fmt, ...) fprintf(stderr, "[TBM:D(%d)(%s:%d)] " fmt, getpid(), __func__, __LINE__, ##__VA_ARGS__) #define TBM_LOG_I(fmt, ...) fprintf(stderr, "[TBM:I(%d)(%s:%d)] " fmt, getpid(), __func__, __LINE__, ##__VA_ARGS__) #define TBM_LOG_W(fmt, ...) fprintf(stderr, "[TBM:W(%d)(%s:%d)] " fmt, getpid(), __func__, __LINE__, ##__VA_ARGS__) #define TBM_LOG_E(fmt, ...) fprintf(stderr, "[TBM:E(%d)(%s:%d)] " fmt, getpid(), __func__, __LINE__, ##__VA_ARGS__) -#endif /* HAVE_DLOG */ - #define TBM_DEBUG(fmt, ...) fprintf(stderr, "[TBM:DEBUG(%d)] " fmt, getpid(), ##__VA_ARGS__) +#endif /* HAVE_DLOG */ /* check condition */ #define TBM_RETURN_IF_FAIL(cond) {\ -- 2.7.4