3 * Copyright 2012 Samsung Electronics Co., Ltd
5 * Licensed under the Flora License, Version 1.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.tizenopensource.org/license
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
24 #ifndef __CALENDAR_LOG_H__
25 #define __CALENDAR_LOG_H__
30 //#define CAL_TIMECHECK
31 //#define CAL_USE_OWN_TIME
34 #define LOG_TAG "CALENDAR"
36 #define DLOG(prio, fmt, arg...) \
37 do { SLOG(prio, LOG_TAG, fmt, ##arg); } while (0)
38 #define INFO(fmt, arg...) SLOGI(fmt, ##arg)
39 #define ERR(fmt, arg...) SLOGE("%s(%d) " fmt, __FUNCTION__, __LINE__, ##arg)
40 #define DBG(fmt, arg...) SLOGD("%s(%d) " fmt, __FUNCTION__, __LINE__, ##arg)
42 #define PRT(prio, fmt, arg...) \
43 do { fprintf((prio?stderr:stdout),"[Calendar]" fmt"\n", ##arg); } while (0)
44 #define INFO(fmt, arg...) PRT(0, fmt, ##arg)
45 #define ERR(fmt, arg...) PRT(1,"%s(%d) " fmt, __FUNCTION__, __LINE__, ##arg)
46 #define DBG(fmt, arg...) \
48 printf("\x1b[105;37m[Calendar]\x1b[0m(%s)" fmt "\n", __FUNCTION__, ##arg); \
54 #ifdef CAL_USE_OWN_TIME
55 #define CAL_FN_START CAL_TIME_CHECK_START
56 #define CAL_FN_END CAL_TIME_CHECK_END
57 #else//CAL_USE_OWN_TIME
59 #define CAL_FN_START DBG("START")
60 #define CAL_FN_END DBG("END")
62 #define CAL_FN_START DBG("")
65 #endif//CAL_USE_OWN_TIME
67 #define c_warn_if(expr, fmt, arg...) do { \
69 ERR("(%s) -> "fmt, #expr, ##arg); \
72 #define c_ret_if(expr) do { \
74 DBG("(%s) -> %s() return", #expr, __FUNCTION__); \
78 #define c_retv_if(expr, val) do { \
80 DBG("(%s) -> %s() return", #expr, __FUNCTION__); \
84 #define c_retm_if(expr, fmt, arg...) do { \
87 DBG("(%s) -> %s() return", #expr, __FUNCTION__); \
91 #define c_retvm_if(expr, val, fmt, arg...) do { \
94 DBG("(%s) -> %s() return", #expr, __FUNCTION__); \
103 #define c_warn_if(expr, fmt, arg...) do { \
108 #define c_ret_if(expr) do { \
113 #define c_retv_if(expr, val) do { \
118 #define c_retm_if(expr, fmt, arg...) do { \
124 #define c_retvm_if(expr, val, fmt, arg...) do { \
131 #endif //CAL_DEBUGGING
134 double cal_correction, cal_startT;
135 double cal_set_start_time(void);
136 double cal_exec_time(double start, double correction);
137 double cal_init_time(double correction);
138 #define CAL_TIME_CHECK_START \
139 double cal_startT = 0, cal_correction = 0; \
140 cal_correction = cal_init_time(cal_correction);\
141 cal_startT = cal_set_start_time();
142 #define CAL_TIME_CHECK_END DBG("time = %f ms\n", cal_exec_time(cal_startT, cal_correction));
143 #else //CAL_TIMECHECK
144 #define CAL_TIME_CHECK_START
145 #define CAL_TIME_CHECK_END
146 #endif //CAL_TIMECHECK
149 #endif /* __CALENDAR_LOG_H__ */