efd24e178496ea7b788d457669b14dffaecb6830
[apps/core/preloaded/taskmanager.git] / src / _util_log.h
1 /*
2  * org.tizen.taskmgr
3  * Copyright (c) 2012 Samsung Electronics Co., Ltd.
4  *
5  * Licensed under the Flora License, Version 1.1 (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
8  *
9  *     http://floralicense.org/license/
10  *
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.
16  */
17
18
19
20
21 #ifndef __TASKMANAGER_UTIL_LOG_H__
22 #define __TASKMANAGER_UTIL_LOG_H__
23
24 #include <unistd.h>
25 #include <dlog.h>
26
27 #undef LOG_TAG
28 #define LOG_TAG "TASKMANAGER"
29 #define _E(fmt, arg...) LOGE("[%s,%d] "fmt,__FUNCTION__,__LINE__,##arg)
30 #define _D(fmt, arg...) LOGD("[%s,%d] "fmt,__FUNCTION__,__LINE__,##arg)
31
32 #define retvm_if(expr, val, fmt, arg...) do { \
33         if(expr) { \
34                 _E(fmt, ##arg); \
35                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
36                 return (val); \
37         } \
38 } while (0)
39
40 #define retv_if(expr, val) do { \
41         if(expr) { \
42                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
43                 return (val); \
44         } \
45 } while (0)
46
47 #define retm_if(expr, fmt, arg...) do { \
48         if(expr) { \
49                 _E(fmt, ##arg); \
50                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
51                 return; \
52         } \
53 } while (0)
54
55 #define ret_if(expr) do { \
56         if(expr) { \
57                 _E("(%s) -> %s() return", #expr, __FUNCTION__); \
58                 return; \
59         } \
60 } while (0)
61
62 #endif
63 /* __TASKMANAGER_UTIL_LOG_H__ */