Remove trivial unnecessary build dependency
[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(_SD)
30 #define _SD(fmt, arg...) SECURE_LOGD(fmt"\n", ##arg)
31 #endif
32
33 #if !defined(_SW)
34 #define _SW(fmt, arg...) SECURE_LOGW(fmt"\n", ##arg)
35 #endif
36
37 #if !defined(_SE)
38 #define _SE(fmt, arg...) SECURE_LOGE(fmt"\n", ##arg)
39 #endif
40
41 #define retvm_if_timer(timer, expr, val, fmt, arg...) do { \
42         if (expr) { \
43                 _E(fmt, ##arg); \
44                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
45                 timer = NULL; \
46                 return (val); \
47         } \
48 } while (0)
49
50 #define retvm_if(expr, val, fmt, arg...) do { \
51         if(expr) { \
52                 _E(fmt, ##arg); \
53                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
54                 return val; \
55         } \
56 } while (0)
57
58 #define retv_if(expr, val) do { \
59         if(expr) { \
60                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
61                 return (val); \
62         } \
63 } while (0)
64
65 #define retm_if(expr, fmt, arg...) do { \
66         if(expr) { \
67                 _E(fmt, ##arg); \
68                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
69                 return; \
70         } \
71 } while (0)
72
73 #define ret_if(expr) do { \
74         if(expr) { \
75                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
76                 return; \
77         } \
78 } while (0)
79
80 #define goto_if(expr, val) do { \
81         if(expr) { \
82                 _E("(%s) -> goto", #expr); \
83                 goto val; \
84         } \
85 } while (0)
86
87 #define break_if(expr) { \
88         if(expr) { \
89                 _E("(%s) -> break", #expr); \
90                 break; \
91         } \
92 }
93
94 #define continue_if(expr) { \
95         if(expr) { \
96                 _E("(%s) -> continue", #expr); \
97                 continue; \
98         } \
99 }
100
101 #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
102
103 #if !defined(_D)
104 #define _D(fmt, arg...) dlog_print(DLOG_DEBUG, LOG_TAG, "%s: %s[%d] " #fmt "\n", __FILENAME__, __func__, __LINE__, ##arg)
105 #endif
106
107 #if !defined(_W)
108 #define _W(fmt, arg...) dlog_print(DLOG_WARN, LOG_TAG, "%s: %s[%d] " #fmt "\n", __FILENAME__, __func__, __LINE__, ##arg)
109 #endif
110
111 #if !defined(_E)
112 #define _E(fmt, arg...) dlog_print(DLOG_ERROR, LOG_TAG, "%s: %s[%d] " #fmt "\n", __FILENAME__, __func__, __LINE__, ##arg)
113 #endif
114
115
116 #endif //__TASK_MGR_LOG_H__