migrate to Tizen 3.0 SDK
[apps/core/preloaded/taskmanager.git] / inc / log.h
1 /*
2  *  Task Manager
3  *
4  * Copyright (c) 2000 - 2015 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef __TASK_MGR_LOG_H__
21 #define __TASK_MGR_LOG_H__
22
23 #include <unistd.h>
24 #include <dlog.h>
25
26 #undef LOG_TAG
27 #define LOG_TAG "TASK_MGR"
28
29 #if !defined(_D)
30 #define _D(fmt, arg...) LOGD(fmt"\n", ##arg)
31 #endif
32
33 #if !defined(_W)
34 #define _W(fmt, arg...) LOGW(fmt"\n", ##arg)
35 #endif
36
37 #if !defined(_E)
38 #define _E(fmt, arg...) LOGE(fmt"\n", ##arg)
39 #endif
40
41 #if !defined(_SD)
42 #define _SD(fmt, arg...) SECURE_LOGD(fmt"\n", ##arg)
43 #endif
44
45 #if !defined(_SW)
46 #define _SW(fmt, arg...) SECURE_LOGW(fmt"\n", ##arg)
47 #endif
48
49 #if !defined(_SE)
50 #define _SE(fmt, arg...) SECURE_LOGE(fmt"\n", ##arg)
51 #endif
52
53 #define retvm_if_timer(timer, expr, val, fmt, arg...) do { \
54         if (expr) { \
55                 _E(fmt, ##arg); \
56                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
57                 timer = NULL; \
58                 return (val); \
59         } \
60 } while (0)
61
62 #define retvm_if(expr, val, fmt, arg...) do { \
63         if(expr) { \
64                 _E(fmt, ##arg); \
65                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
66                 return val; \
67         } \
68 } while (0)
69
70 #define retv_if(expr, val) do { \
71         if(expr) { \
72                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
73                 return (val); \
74         } \
75 } while (0)
76
77 #define retm_if(expr, fmt, arg...) do { \
78         if(expr) { \
79                 _E(fmt, ##arg); \
80                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
81                 return; \
82         } \
83 } while (0)
84
85 #define ret_if(expr) do { \
86         if(expr) { \
87                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
88                 return; \
89         } \
90 } while (0)
91
92 #define goto_if(expr, val) do { \
93         if(expr) { \
94                 _E("(%s) -> goto", #expr); \
95                 goto val; \
96         } \
97 } while (0)
98
99 #define break_if(expr) { \
100         if(expr) { \
101                 _E("(%s) -> break", #expr); \
102                 break; \
103         } \
104 }
105
106 #define continue_if(expr) { \
107         if(expr) { \
108                 _E("(%s) -> continue", #expr); \
109                 continue; \
110         } \
111 }
112
113
114
115 #endif //__TASK_MGR_LOG_H__