tizen 2.3 release
[framework/pim/account-parser.git] / src / account-dlog.h
1 //
2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0
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 __ACCOUNT_PARSER_DLOG_H__
18 #define __ACCOUNT_PARSER_DLOG_H__
19
20 #include <dlog.h>
21
22 #define COLOR_GREEN     "\033[0;32m"
23 #define COLOR_END               "\033[0;m"
24
25 #ifdef LOG_TAG
26 #undef LOG_TAG
27 #endif
28
29 #define LOG_TAG "ACCOUNT_PARSER"
30
31 #define _E(fmt, arg...) LOGE("[%s:%d] "fmt,__FUNCTION__,__LINE__,##arg)
32 #define _D(fmt, arg...) LOGD("[%s:%d] "fmt,__FUNCTION__,__LINE__,##arg)
33 #define _SECURE_E(fmt, arg...) SECURE_LOGE("[%s:%d] "fmt,__FUNCTION__,__LINE__,##arg)
34 #define _SECURE_D(fmt, arg...) SECURE_LOGD("[%s:%d] "fmt,__FUNCTION__,__LINE__,##arg)
35 #define ENTER() LOGD(COLOR_GREEN"BEGIN >>>"COLOR_END);
36
37 #define retvm_if(expr, val, fmt, arg...) do { \
38         if(expr) { \
39                 _E(fmt, ##arg); \
40                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
41                 return (val); \
42         } \
43 } while (0)
44
45 #define retv_if(expr, val) do { \
46         if(expr) { \
47                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
48                 return (val); \
49         } \
50 } while (0)
51
52 #define retm_if(expr, fmt, arg...) do { \
53         if(expr) { \
54                 _E(fmt, ##arg); \
55                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
56                 return; \
57         } \
58 } while (0)
59
60 #define ret_if(expr) do { \
61         if(expr) { \
62                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
63                 return; \
64         } \
65 } while (0)
66
67 #endif                          /* __ACCOUNT_PARSER_DLOG_H__ */