2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.tizenopensource.org/license
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
34 #define LOG_TAG "GALLERY"
35 #define LOG_TAG_LAUNCH "GALLERY_LAUNCH"
37 /* anci c color type */
38 #define FONT_COLOR_RESET "\033[0m"
39 #define FONT_COLOR_RED "\033[31m"
40 #define FONT_COLOR_GREEN "\033[32m"
41 #define FONT_COLOR_YELLOW "\033[33m"
42 #define FONT_COLOR_BLUE "\033[34m"
43 #define FONT_COLOR_PURPLE "\033[35m"
44 #define FONT_COLOR_CYAN "\033[36m"
45 #define FONT_COLOR_GRAY "\033[37m"
49 #endif // _USE_LOG_FILE_
53 #define gl_dbg(fmt,arg...) fprintf(g_log_fp, "[%s: %d]" fmt "\n", __FUNCTION__, __LINE__, ##arg)
55 #elif defined _USE_DLOG_
57 #define gl_dbg(fmt, arg...) LOGD("[%s : %d] " fmt "\n", __FUNCTION__, __LINE__, ##arg)
58 #define gl_dbgW(fmt, arg...) LOGW(FONT_COLOR_GREEN"[%s : %d] " fmt "\n"FONT_COLOR_RESET, __FUNCTION__, __LINE__, ##arg)
59 #define gl_dbgE(fmt, arg...) LOGE(FONT_COLOR_RED"[%s : %d] " fmt "\n"FONT_COLOR_RESET, __FUNCTION__, __LINE__, ##arg)
64 const char *szcategory;
67 void _custom_debug_msg(debug_msg_type *debug_msg, const char *msg, ...);
69 #define __LAUNCH_TEST_LOG(szCat, ...) \
73 static debug_msg_type msg______unique______name___ = { \
78 _custom_debug_msg(&msg______unique______name___, ##__VA_ARGS__); \
82 #define gl_dbg_launch(...) __LAUNCH_TEST_LOG(LOG_TAG_LAUNCH, ##__VA_ARGS__)
85 #elif defined _USE_LOG_CONSOLE_
87 #define gl_dbg(fmt,arg...) fprintf(stdout, "[%s: %d]" fmt "\n", __FUNCTION__, __LINE__, ##arg)
88 #define gl_dbgW(fmt, arg...) fprintf(stdout, "[%s : %d] " fmt "\n", __FUNCTION__, __LINE__, ##arg)
89 #define gl_dbgE(fmt, arg...) fprintf(stdout, "[%s : %d] " fmt "\n", __FUNCTION__, __LINE__, ##arg)
93 #define gl_dbg(fmt,arg...)
94 #define gl_dbgW(fmt, arg...)
95 #define gl_dbgE(fmt, arg...)
98 //void gl_init_debug_handler (const char *appname);
99 //void gl_close_debug_handler();
102 #include <sys/time.h>
104 //long gl_get_debug_time(void);
105 //void gl_reset_debug_time(void);
106 //void gl_print_debug_time(char* time_string);
107 void gl_print_debug_time_ex(long start, long end, const char *func_name, char *time_string);
111 #define gl_retm_if(expr, fmt, arg...) do { \
113 gl_dbgE(fmt, ##arg); \
114 gl_dbgE("(%s) -> %s() return", #expr, __FUNCTION__); \
119 #define gl_retvm_if(expr, val, fmt, arg...) do { \
121 gl_dbgE(fmt, ##arg); \
122 gl_dbgE("(%s) -> %s() return", #expr, __FUNCTION__); \
127 #define GL_CHECK_EXCEP(expr) do { \
129 gl_dbgE("Critical ERROR ########################################## Check below item.");\
134 #define GL_CHECK_VAL(expr, val) gl_retvm_if(!(expr), val, "Invalid parameter, return ERROR code!")
135 #define GL_CHECK_NULL(expr) gl_retvm_if(!(expr), NULL, "Invalid parameter, return NULL!")
136 #define GL_CHECK_FALSE(expr) gl_retvm_if(!(expr), false, "Invalid parameter, return FALSE!")
137 #define GL_CHECK_CANCEL(expr) gl_retvm_if(!(expr), ECORE_CALLBACK_CANCEL, "Invalid parameter, return ECORE_CALLBACK_CANCEL!")
138 #define GL_CHECK(expr) gl_retm_if(!(expr), "Invalid parameter, return!")
140 #define gl_assert(expr) do { \
142 gl_dbgE("Critical ERROR ########################################## Check below item.");\
151 #endif /* _GL_DEBUG_H_ */