apply FSL(Flora Software License)
[apps/core/preloaded/libslp-alarm.git] / kies_alarm / include / kies_dlog.h
1 /*
2   * Copyright 2012  Samsung Electronics Co., Ltd
3   * 
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
7   * 
8   *     http://www.tizenopensource.org/license
9   * 
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.
15   */
16
17 #ifndef __KIES_DLOG_H__
18 #define __KIES_DLOG_H__
19
20 #include <stdio.h>
21 #include <assert.h>
22 #include <dlog.h>
23 /**********************************************************************
24 ******************define, struct ,typedef, union, enum, global val *************************************
25 ***********************************************************************/
26 #define KIES_FUN_BEG()   KIES_INFO("====>>>>fun=%s, BEGIN====>>>>", __FUNCTION__);
27 #define KIES_FUN_END()   KIES_INFO("====>>>>fun=%s, END====>>>>",  __FUNCTION__);
28 #define KIES_INFO(fmt, arg...) LOGD("[%s:%d] "fmt, __FILE__, __LINE__, ##arg);
29 #define KIES_ERR(fmt, arg...) LOGE(FONT_COLOR_RED"[%s:%d] "fmt FONT_COLOR_RESET, __FILE__, __LINE__, ##arg);
30
31 #define KIES_FUN_DEBUG_BEG()    //KIES_INFO("====>>>>fun=%s, BEGIN====>>>>", __FUNCTION__);
32 #define KIES_FUN_DEBUG_END()    //KIES_INFO("====>>>>fun=%s, END====>>>>",  __FUNCTION__);
33 #define KIES_DEBUG_INFO(fmt, arg...)    //KIES_INFO(fmt, ##arg)
34 #define KIES_DEBUG_INFO(fmt, arg...)    //KIES_ERR(fmt, ##arg)
35
36 #define KIES_RET_IF(expr) \
37     do { \
38                 if (expr) { \
39                     nErr = FAILED;\
40                     KIES_INFO_RED("!!!!!!!!!!!!!!!!!!!! CHECK nErr=%d!!!!!!! \n(%s)return!!!!!!!!!!!\n\n", nErr, #expr); \
41                     goto End; \
42                 } \
43         } \
44     } while (0);
45 #define KIES_RETV_IF(expr, val) \
46         do { \
47                 if (expr) { \
48                     nErr = FAILED;\
49                     ret = val;\
50                     KIES_INFO_RED("!!!!!!!!!!!!!!!!!!!! CHECK nErr=%d!!!!!!! \n(%s)return!!!!!!!!!!!\n\n", nErr, #expr); \
51                     goto End; \
52                 } \
53         } while (0);
54 #define KIES_RETE_IF(expr, errorId) \
55     do { \
56                 if (expr) { \
57                     nErr = errorId;\
58                     KIES_INFO_RED("!!!!!!!!!!!!!!!!!!!! CHECK nErr=%d!!!!!!! \n(%s)return!!!!!!!!!!!\n\n", nErr, #expr); \
59                     goto End; \
60         } \
61     } while (0);
62 #define KIES_RETEM_IF(expr, errorId, fmt, arg...) \
63     do { \
64                 if (expr) { \
65                     nErr = errorId;\
66                 KIES_INFO_RED(fmt, ##arg); \
67                     KIES_INFO_RED("!!!!!!!!!!!!!!!!!!!! CHECK nErr=%d!!!!!!! \n(%s)return!!!!!!!!!!!\n\n", nErr, #expr); \
68                     goto End; \
69                 } \
70     } while (0);
71 #define KIES_RETVE_IF(expr, val, errorId) \
72     do { \
73                 if (expr) { \
74                     nErr = errorId;\
75                     ret = val;\
76                     KIES_INFO_RED("!!!!!!!!!!!!!!!!!!!! CHECK nErr=%d!!!!!!! \n(%s)return!!!!!!!!!!!\n\n", nErr, #expr); \
77                     goto End; \
78                 } \
79     } while (0);
80 #define KIES_RETM_IF(expr, fmt, arg...) \
81     do { \
82                 if (expr) { \
83                     nErr = FAILED;\
84                     KIES_INFO_RED(fmt, ##arg); \
85                     KIES_INFO_RED("!!!!!!!!!!!!!!!!!!!! CHECK nErr=%d!!!!!!! \n(%s)return!!!!!!!!!!!\n\n", nErr, #expr); \
86                     goto End; \
87                 } \
88     } while (0);
89 #define KIES_RETVM_IF(expr, val, fmt, arg...) \
90     do { \
91                 if (expr) { \
92                     nErr = FAILED;\
93                     ret = val;\
94                     KIES_INFO_RED(fmt, ##arg); \
95                     KIES_INFO_RED("!!!!!!!!!!!!!!!!!!!! CHECK nErr=%d!!!!!!! \n(%s)return!!!!!!!!!!!\n\n", nErr, #expr); \
96                     goto End; \
97                 } \
98     } while (0);
99 #define KIES_RETVME_IF(expr, val, errorId, fmt, arg...) \
100     do { \
101                 if (expr) { \
102                     nErr = errorId;\
103                     ret = val;\
104                     KIES_INFO_RED(fmt, ##arg); \
105                     KIES_INFO_RED("!!!!!!!!!!!!!!!!!!!! CHECK nErr=%d!!!!!!! \n(%s)return!!!!!!!!!!!\n\n", nErr, #expr); \
106                     goto End; \
107                 }  \
108     } while (0);
109 /* anci c color type */
110 #define FONT_COLOR_RESET    "\033[0m"
111 #define FONT_COLOR_RED      "\033[31m"
112 #define FONT_COLOR_GREEN    "\033[32m"
113 #define FONT_COLOR_YELLOW   "\033[33m"
114 #define FONT_COLOR_BLUE     "\033[34m"
115 #define FONT_COLOR_PURPLE   "\033[35m"
116 #define FONT_COLOR_CYAN     "\033[36m"
117 #define FONT_COLOR_GRAY     "\033[37m"
118
119 #define KIES_INFO_RED(fmt, arg...) KIES_INFO(FONT_COLOR_RED fmt FONT_COLOR_RESET, ##arg)
120 #define KIES_INFO_GREEN(fmt, arg...) KIES_INFO(FONT_COLOR_GREEN fmt FONT_COLOR_RESET, ##arg)
121 #define KIES_INFO_YELLOW(fmt, arg...) KIES_INFO(FONT_COLOR_YELLOW fmt FONT_COLOR_RESET, ##arg)
122 #define KIES_INFO_BLUE(fmt, arg...) KIES_INFO(FONT_COLOR_BLUE fmt FONT_COLOR_RESET, ##arg)
123 #define KIES_INFO_PURPLE(fmt, arg...) KIES_INFO(FONT_COLOR_PURPLE fmt FONT_COLOR_RESET, ##arg)
124 #define KIES_INFO_GREEN(fmt, arg...) KIES_INFO(FONT_COLOR_GREEN fmt FONT_COLOR_RESET, ##arg)
125 #define KIES_INFO_CYAN(fmt, arg...) KIES_INFO(FONT_COLOR_CYAN fmt FONT_COLOR_RESET, ##arg)
126 #define KIES_INFO_GRAY(fmt, arg...) KIES_INFO(FONT_COLOR_GRAY fmt FONT_COLOR_RESET, ##arg)
127
128 #define KIES_INFO_WITH_COLOR(color, fmt, arg...) KIES_INFO(color fmt FONT_COLOR_RESET, ##arg)
129
130 #endif                          //__KIES_DLOG_H__