summaryrefslogtreecommitdiff
path: root/common/include/ivug-debug.h
diff options
context:
space:
mode:
authorKim Kibum <kb0929.kim@samsung.com>2012-06-08 05:54:16 (GMT)
committerKim Kibum <kb0929.kim@samsung.com>2012-06-08 05:54:16 (GMT)
commit8b42d4bb33943903b7160bb963bf7e7c6824e9ef (patch)
tree021a596daee9f7e379b8914aad343a2342528e47 /common/include/ivug-debug.h
parent7164c202e81bc53033dce636367d92b93265b915 (diff)
downloadug-image-viewer-efl-8b42d4bb33943903b7160bb963bf7e7c6824e9ef.zip
ug-image-viewer-efl-8b42d4bb33943903b7160bb963bf7e7c6824e9ef.tar.gz
ug-image-viewer-efl-8b42d4bb33943903b7160bb963bf7e7c6824e9ef.tar.bz2
apply FSL(Flora Software License)
Diffstat (limited to 'common/include/ivug-debug.h')
-rwxr-xr-xcommon/include/ivug-debug.h251
1 files changed, 251 insertions, 0 deletions
diff --git a/common/include/ivug-debug.h b/common/include/ivug-debug.h
new file mode 100755
index 0000000..fae7537
--- /dev/null
+++ b/common/include/ivug-debug.h
@@ -0,0 +1,251 @@
+/*
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#ifndef _IVUG_DEBUG_H_
+#define _IVUG_DEBUG_H_
+
+#include <dlog.h>
+
+#define IVUG_LOG_OUTPUT_DLOG
+
+enum {
+ IVUG_MSG_COLOR_DEFAULT = 0,
+ IVUG_MSG_COLOR_BLACK = 30,
+ IVUG_MSG_COLOR_RED = 31,
+ IVUG_MSG_COLOR_GREEN = 32,
+ IVUG_MSG_COLOR_YELLOW = 33,
+ IVUG_MSG_COLOR_BLUE = 34,
+ IVUG_MSG_COLOR_MAGENTA = 35,
+ IVUG_MSG_COLOR_CYAN = 36,
+ IVUG_MSG_COLOR_WHITE = 37,
+};
+
+#ifdef IVUG_LOG_OUTPUT_DLOG
+
+#undef LOG_TAG
+#define LOG_TAG "IV-COMMON"
+
+#define IVUG_DEBUG_MSG(fmt, arg...) LOGD("[%s : %05d]" fmt "\n", __func__, __LINE__, ##arg)
+#define IVUG_DEBUG_WARNING(fmt, arg...) LOGW("[%s : %05d]" fmt "\n", __func__, __LINE__, ##arg)
+#define IVUG_DEBUG_ERROR(fmt, arg...) LOGE("[%s : %05d]" fmt "\n", __func__, __LINE__ , ##arg)
+#define IVUG_DEBUG_CRITICAL(fmt, arg...) LOGE("[%s : %05d]" fmt "\n", __func__, __LINE__ , ##arg)
+
+#else //USE_DLOG
+#define IVUG_DEBUG_MSG(fmt, arg...) fprintf(stdout, "[D: %s : %05d]" fmt "\n", __func__, __LINE__, ##arg)
+#define IVUG_DEBUG_WARNING(fmt, arg...) fprintf(stdout, "[W: %s : %05d]" fmt "\n", __func__, __LINE__, ##arg)
+#define IVUG_DEBUG_ERROR(fmt, arg...) fprintf(stdout, "[E: %s : %05d]" fmt "\n", __func__, __LINE__ , ##arg)
+#define IVUG_DEBUG_CRITICAL(fmt, arg...) fprintf(stdout, "[E: %s : %05d]" fmt "\n", __func__, __LINE__ , ##arg)
+#define IVUG_DEBUG_PRINT(fmt,arg...) fprintf(stdout, "[%s : %05d] >>> leave \n", __func__, __LINE__ , ##arg)
+
+#endif //IVUG_LOG_OUTPUT_DLOG
+
+/*
+ How to add new Category..
+
+ TODO:
+*/
+
+#define MSG_MOUSE_SZCAT "IV-MOUSE"
+#define LVL_MOUSE DBG_MSG_LVL_HIGH
+
+#define MSG_MOUSE_FATAL(...) __MSG_FATAL(LVL_MOUSE, MSG_MOUSE_SZCAT, ##__VA_ARGS__)
+#define MSG_MOUSE_ERROR(...) __MSG_ERROR(LVL_MOUSE, MSG_MOUSE_SZCAT, ##__VA_ARGS__)
+#define MSG_MOUSE_WARN(...) __MSG_WARN(LVL_MOUSE, MSG_MOUSE_SZCAT, ##__VA_ARGS__)
+#define MSG_MOUSE_HIGH(...) __MSG_HIGH(LVL_MOUSE, MSG_MOUSE_SZCAT, ##__VA_ARGS__)
+#define MSG_MOUSE_MED(...) __MSG_MED(LVL_MOUSE, MSG_MOUSE_SZCAT, ##__VA_ARGS__)
+#define MSG_MOUSE_LOW(...) __MSG_LOW(LVL_MOUSE, MSG_MOUSE_SZCAT, ##__VA_ARGS__)
+
+
+#define SLIDER_ITEM_SZ "IV-SITEM"
+#define LVL_SLIDER_ITEM DBG_MSG_LVL_HIGH
+
+
+#define MSG_SITEM_FATAL(...) __MSG_FATAL(LVL_SLIDER_ITEM, SLIDER_ITEM_SZ, ##__VA_ARGS__)
+#define MSG_SITEM_ERROR(...) __MSG_ERROR(LVL_SLIDER_ITEM, SLIDER_ITEM_SZ, ##__VA_ARGS__)
+#define MSG_SITEM_WARN(...) __MSG_WARN(LVL_SLIDER_ITEM, SLIDER_ITEM_SZ, ##__VA_ARGS__)
+#define MSG_SITEM_HIGH(...) __MSG_HIGH(LVL_SLIDER_ITEM, SLIDER_ITEM_SZ, ##__VA_ARGS__)
+#define MSG_SITEM_MED(...) __MSG_MED(LVL_SLIDER_ITEM, SLIDER_ITEM_SZ, ##__VA_ARGS__)
+#define MSG_SITEM_LOW(...) __MSG_LOW(LVL_SLIDER_ITEM, SLIDER_ITEM_SZ, ##__VA_ARGS__)
+
+
+#define SLIDER_SZ "IV-SLIDER"
+#define LVL_SLIDER DBG_MSG_LVL_HIGH
+
+#define MSG_SLIDER_FATAL(...) __MSG_FATAL(LVL_SLIDER, SLIDER_SZ, ##__VA_ARGS__)
+#define MSG_SLIDER_ERROR(...) __MSG_ERROR(LVL_SLIDER, SLIDER_SZ, ##__VA_ARGS__)
+#define MSG_SLIDER_WARN(...) __MSG_WARN(LVL_SLIDER, SLIDER_SZ, ##__VA_ARGS__)
+#define MSG_SLIDER_HIGH(...) __MSG_HIGH(LVL_SLIDER, SLIDER_SZ, ##__VA_ARGS__)
+#define MSG_SLIDER_MED(...) __MSG_MED(LVL_SLIDER, SLIDER_SZ, ##__VA_ARGS__)
+#define MSG_SLIDER_LOW(...) __MSG_LOW(LVL_SLIDER, SLIDER_SZ, ##__VA_ARGS__)
+
+#define SETAS_SZ "IV-SETAS"
+#define LVL_SETAS DBG_MSG_LVL_HIGH
+
+#define MSG_SETAS_FATAL(...) __MSG_FATAL(LVL_SETAS, SETAS_SZ, ##__VA_ARGS__)
+#define MSG_SETAS_ERROR(...) __MSG_ERROR(LVL_SETAS, SETAS_SZ, ##__VA_ARGS__)
+#define MSG_SETAS_WARN(...) __MSG_WARN(LVL_SETAS, SETAS_SZ, ##__VA_ARGS__)
+#define MSG_SETAS_HIGH(...) __MSG_HIGH(LVL_SETAS, SETAS_SZ, ##__VA_ARGS__)
+#define MSG_SETAS_MED(...) __MSG_MED(LVL_SETAS, SETAS_SZ, ##__VA_ARGS__)
+#define MSG_SETAS_LOW(...) __MSG_LOW(LVL_SETAS, SETAS_SZ, ##__VA_ARGS__)
+
+#define DETAIL_SZ "IV-DETAIL"
+#define LVL_DETAIL DBG_MSG_LVL_MED
+
+#define MSG_DETAIL_FATAL(...) __MSG_FATAL(LVL_DETAIL, DETAIL_SZ, ##__VA_ARGS__)
+#define MSG_DETAIL_ERROR(...) __MSG_ERROR(LVL_DETAIL, DETAIL_SZ, ##__VA_ARGS__)
+#define MSG_DETAIL_WARN(...) __MSG_WARN(LVL_DETAIL, DETAIL_SZ, ##__VA_ARGS__)
+#define MSG_DETAIL_HIGH(...) __MSG_HIGH(LVL_DETAIL, DETAIL_SZ, ##__VA_ARGS__)
+#define MSG_DETAIL_MED(...) __MSG_MED(LVL_DETAIL, DETAIL_SZ, ##__VA_ARGS__)
+#define MSG_DETAIL_LOW(...) __MSG_LOW(LVL_DETAIL, DETAIL_SZ, ##__VA_ARGS__)
+
+#define SDATA_SZ "IV-SDATA"
+#define LVL_SDATA DBG_MSG_LVL_HIGH
+
+#define MSG_SDATA_FATAL(...) __MSG_FATAL(LVL_SDATA, SDATA_SZ, ##__VA_ARGS__)
+#define MSG_SDATA_ERROR(...) __MSG_ERROR(LVL_SDATA, SDATA_SZ, ##__VA_ARGS__)
+#define MSG_SDATA_WARN(...) __MSG_WARN(LVL_SDATA, SDATA_SZ, ##__VA_ARGS__)
+#define MSG_SDATA_HIGH(...) __MSG_HIGH(LVL_SDATA, SDATA_SZ, ##__VA_ARGS__)
+#define MSG_SDATA_MED(...) __MSG_MED(LVL_SDATA, SDATA_SZ, ##__VA_ARGS__)
+#define MSG_SDATA_LOW(...) __MSG_LOW(LVL_SDATA, SDATA_SZ, ##__VA_ARGS__)
+
+
+#define IVCOMMON_SZ "IV-COMMON"
+#define LVL_IVCOMMON DBG_MSG_LVL_HIGH
+
+#define MSG_IMAGEVIEW_FATAL(...) __MSG_FATAL(LVL_IVCOMMON, IVCOMMON_SZ, ##__VA_ARGS__)
+#define MSG_IMAGEVIEW_ERROR(...) __MSG_ERROR(LVL_IVCOMMON, IVCOMMON_SZ, ##__VA_ARGS__)
+#define MSG_IMAGEVIEW_WARN(...) __MSG_WARN(LVL_IVCOMMON, IVCOMMON_SZ, ##__VA_ARGS__)
+#define MSG_IMAGEVIEW_HIGH(...) __MSG_HIGH(LVL_IVCOMMON, IVCOMMON_SZ, ##__VA_ARGS__)
+#define MSG_IMAGEVIEW_MED(...) __MSG_MED(LVL_IVCOMMON, IVCOMMON_SZ, ##__VA_ARGS__)
+#define MSG_IMAGEVIEW_LOW(...) __MSG_LOW(LVL_IVCOMMON, IVCOMMON_SZ, ##__VA_ARGS__)
+
+#define MAINVIEW_SZ "IV-MAIN"
+#define LVL_MAINVIEW DBG_MSG_LVL_HIGH
+
+#define MSG_MAIN_FATAL(...) __MSG_FATAL(LVL_MAINVIEW, MAINVIEW_SZ, ##__VA_ARGS__)
+#define MSG_MAIN_ERROR(...) __MSG_ERROR(LVL_MAINVIEW, MAINVIEW_SZ, ##__VA_ARGS__)
+#define MSG_MAIN_WARN(...) __MSG_WARN(LVL_MAINVIEW, MAINVIEW_SZ, ##__VA_ARGS__)
+#define MSG_MAIN_HIGH(...) __MSG_HIGH(LVL_MAINVIEW, MAINVIEW_SZ, ##__VA_ARGS__)
+#define MSG_MAIN_MED(...) __MSG_MED(LVL_MAINVIEW, MAINVIEW_SZ, ##__VA_ARGS__)
+#define MSG_MAIN_LOW(...) __MSG_LOW(LVL_MAINVIEW, MAINVIEW_SZ, ##__VA_ARGS__)
+
+#define UTIL_SZ "IV-UTIL"
+#define LVL_UTIL DBG_MSG_LVL_HIGH
+
+#define MSG_UTIL_FATAL(...) __MSG_FATAL(LVL_UTIL, UTIL_SZ, ##__VA_ARGS__)
+#define MSG_UTIL_ERROR(...) __MSG_ERROR(LVL_UTIL, UTIL_SZ, ##__VA_ARGS__)
+#define MSG_UTIL_WARN(...) __MSG_WARN(LVL_UTIL, UTIL_SZ, ##__VA_ARGS__)
+#define MSG_UTIL_HIGH(...) __MSG_HIGH(LVL_UTIL, UTIL_SZ, ##__VA_ARGS__)
+#define MSG_UTIL_MED(...) __MSG_MED(LVL_UTIL, UTIL_SZ, ##__VA_ARGS__)
+#define MSG_UTIL_LOW(...) __MSG_LOW(LVL_UTIL, UTIL_SZ, ##__VA_ARGS__)
+
+#define IVUG_SZ "IV-COMMON"
+#define LVL_IVUG DBG_MSG_LVL_HIGH
+
+#define MSG_IVUG_FATAL(...) __MSG_FATAL(LVL_IVUG, IVUG_SZ, ##__VA_ARGS__)
+#define MSG_IVUG_ERROR(...) __MSG_ERROR(LVL_IVUG, IVUG_SZ, ##__VA_ARGS__)
+#define MSG_IVUG_WARN(...) __MSG_WARN(LVL_IVUG, IVUG_SZ, ##__VA_ARGS__)
+#define MSG_IVUG_HIGH(...) __MSG_HIGH(LVL_IVUG, IVUG_SZ, ##__VA_ARGS__)
+#define MSG_IVUG_MED(...) __MSG_MED(LVL_IVUG, IVUG_SZ, ##__VA_ARGS__)
+#define MSG_IVUG_LOW(...) __MSG_LOW(LVL_IVUG, IVUG_SZ, ##__VA_ARGS__)
+
+#define NOTI_SZ "IV-NOTI"
+#define LVL_NOTI DBG_MSG_LVL_LOW
+
+#define MSG_NOTI_FATAL(...) __MSG_FATAL(LVL_NOTI, NOTI_SZ, ##__VA_ARGS__)
+#define MSG_NOTI_ERROR(...) __MSG_ERROR(LVL_NOTI, NOTI_SZ, ##__VA_ARGS__)
+#define MSG_NOTI_WARN(...) __MSG_WARN(LVL_NOTI, NOTI_SZ, ##__VA_ARGS__)
+#define MSG_NOTI_HIGH(...) __MSG_HIGH(LVL_NOTI, NOTI_SZ, ##__VA_ARGS__)
+#define MSG_NOTI_MED(...) __MSG_MED(LVL_NOTI, NOTI_SZ, ##__VA_ARGS__)
+#define MSG_NOTI_LOW(...) __MSG_LOW(LVL_NOTI, NOTI_SZ, ##__VA_ARGS__)
+
+#define PHOTO_SZ "IV-PHOTO"
+#define LVL_PHOTO DBG_MSG_LVL_HIGH
+
+#define MSG_PHOTO_FATAL(...) __MSG_FATAL(LVL_PHOTO, PHOTO_SZ, ##__VA_ARGS__)
+#define MSG_PHOTO_ERROR(...) __MSG_ERROR(LVL_PHOTO, PHOTO_SZ, ##__VA_ARGS__)
+#define MSG_PHOTO_WARN(...) __MSG_WARN(LVL_PHOTO, PHOTO_SZ, ##__VA_ARGS__)
+#define MSG_PHOTO_HIGH(...) __MSG_HIGH(LVL_PHOTO, PHOTO_SZ, ##__VA_ARGS__)
+#define MSG_PHOTO_MED(...) __MSG_MED(LVL_PHOTO, PHOTO_SZ, ##__VA_ARGS__)
+#define MSG_PHOTO_LOW(...) __MSG_LOW(LVL_PHOTO, PHOTO_SZ, ##__VA_ARGS__)
+
+#define EFFECT_SZ "IV-EFFECT"
+#define LVL_EFFECT DBG_MSG_LVL_HIGH
+
+#define MSG_EFFECT_FATAL(...) __MSG_FATAL(LVL_EFFECT, EFFECT_SZ, ##__VA_ARGS__)
+#define MSG_EFFECT_ERROR(...) __MSG_ERROR(LVL_EFFECT, EFFECT_SZ, ##__VA_ARGS__)
+#define MSG_EFFECT_WARN(...) __MSG_WARN(LVL_EFFECT, EFFECT_SZ, ##__VA_ARGS__)
+#define MSG_EFFECT_HIGH(...) __MSG_HIGH(LVL_EFFECT, EFFECT_SZ, ##__VA_ARGS__)
+#define MSG_EFFECT_MED(...) __MSG_MED(LVL_EFFECT, EFFECT_SZ, ##__VA_ARGS__)
+#define MSG_EFFECT_LOW(...) __MSG_LOW(LVL_EFFECT, EFFECT_SZ, ##__VA_ARGS__)
+
+
+#define SLIST_ITEM_SZ "IV-SLIST"
+#define LVL_SLIST_ITEM DBG_MSG_LVL_HIGH
+
+#define MSG_SLIST_FATAL(...) __MSG_FATAL(LVL_SLIST_ITEM, SLIST_ITEM_SZ, ##__VA_ARGS__)
+#define MSG_SLIST_ERROR(...) __MSG_ERROR(LVL_SLIST_ITEM, SLIST_ITEM_SZ, ##__VA_ARGS__)
+#define MSG_SLIST_WARN(...) __MSG_WARN(LVL_SLIST_ITEM, SLIST_ITEM_SZ, ##__VA_ARGS__)
+#define MSG_SLIST_HIGH(...) __MSG_HIGH(LVL_SLIST_ITEM, SLIST_ITEM_SZ, ##__VA_ARGS__)
+#define MSG_SLIST_MED(...) __MSG_MED(LVL_SLIST_ITEM, SLIST_ITEM_SZ, ##__VA_ARGS__)
+#define MSG_SLIST_LOW(...) __MSG_LOW(LVL_SLIST_ITEM, SLIST_ITEM_SZ, ##__VA_ARGS__)
+
+
+#define IV_ASSERT(expr) ASSERT(DBG_MSG_LVL_ALL, "IV-COMMON", expr)
+
+
+#define IVUG_FUNC_ENTER() MSG_IVUG_HIGH("ENTER %s(L%d)", __func__, __LINE__)
+#define IVUG_FUNC_LEAVE() MSG_IVUG_HIGH("LEAVE %s(L%d)", __func__, __LINE__)
+
+//expr check statements
+#define ivug_ret_if(expr) \
+ do { \
+ if(expr) { \
+ MSG_IMAGEVIEW_WARN("[%s] Return", #expr );\
+ return; \
+ } \
+ } while (0)
+
+#define ivug_retv_if(expr, val) \
+ do { \
+ if(expr) { \
+ MSG_IMAGEVIEW_WARN("[%s] Return value %d", #expr, val );\
+ return (val); \
+ } \
+ } while (0)
+
+#define ivug_retm_if(expr, fmt, args...) \
+ do { \
+ if(expr) { \
+ MSG_IMAGEVIEW_WARN("[%s] Return, message "fmt, #expr, ##args );\
+ return; \
+ } \
+ } while (0)
+
+#define ivug_retvm_if(expr, val, fmt, args...) \
+ do { \
+ if(expr) { \
+ MSG_IMAGEVIEW_WARN("[%s] Return value, message "fmt, #expr, ##args );\
+ return (val); \
+ } \
+ } while (0)
+
+
+#include "debug.h"
+
+
+#endif //_IVUG_DEBUG_H_