[SSM] Modify ommited arduino sample and soft sensor sample
[platform/upstream/iotivity.git] / service / soft-sensor-manager / SoftSensorPlugin / IndoorTrajectorySensor / include / tizen_log.h
1 /******************************************************************
2 *
3 * Copyright 2014 Samsung Electronics All Rights Reserved.
4 *
5 *
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 *      http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 ******************************************************************/
20 #ifndef __OICAPP_LOG_H__
21 #define __OICAPP_LOG_H__
22
23 #define TIZEN_DEBUG_ENABLE
24 #define LOG_TAG "OIC_TEST"
25 #include <dlog.h>
26
27 #define LOG_COLOR_RED       "\033[0;31m"
28 #define LOG_COLOR_BROWN     "\033[0;33m"
29 #define LOG_COLOR_BLUE      "\033[0;34m"
30 #define LOG_COLOR_END       "\033[0;m"
31
32
33 #if 0
34 #define _DBG(fmt, arg...) SLOGD(fmt, ##arg)
35 #define _INFO(fmt, arg...) SLOGI(fmt, ##arg)
36 #define _WARN(fmt, arg...) SLOGW(fmt, ##arg)
37 #define _ERR(fmt, arg...) SLOGE(fmt, ##arg)
38 #else
39 #define _DBG(fmt, arg...) \
40     printf("[OIC_TEST]%s(%d):" fmt "\n", __FUNCTION__, __LINE__, ##arg)
41 #define _INFO(fmt, arg...) \
42     printf("[OIC_TEST]%s(%d):" fmt "\n", __FUNCTION__, __LINE__, ##arg)
43 #define _WARN(fmt, arg...) \
44     printf("[OIC_TEST]%s(%d):" fmt "\n", __FUNCTION__, __LINE__, ##arg)
45 #define _ERR(fmt, arg...) \
46     printf("[OIC_TEST]%s(%d):" fmt "\n", __FUNCTION__, __LINE__, ##arg)
47 #endif
48
49 #define DBG(fmt, arg...) _DBG(fmt, ##arg)
50 #define WARN(fmt, arg...) _WARN(LOG_COLOR_BROWN fmt LOG_COLOR_END, ##arg)
51 #define ERR(fmt, arg...) _ERR(LOG_COLOR_RED fmt LOG_COLOR_END, ##arg)
52 #define INFO(fmt, arg...) _INFO(LOG_COLOR_BLUE fmt LOG_COLOR_END, ##arg)
53
54 #define ret_if(expr) \
55     do { \
56         if (expr) { \
57             ERR("(%s)", #expr); \
58             return; \
59         }\
60     } while(0)
61 #define retv_if(expr, val) \
62     do {\
63         if (expr) { \
64             ERR("(%s)", #expr); \
65             return (val); \
66         } \
67     } while(0)
68 #define retm_if(expr, fmt, arg...) \
69     do {\
70         if (expr) { \
71             ERR(fmt, ##arg); \
72             return; \
73         }\
74     } while(0)
75 #define retvm_if(expr, val, fmt, arg...) \
76     do {\
77         if (expr) { \
78             ERR(fmt, ##arg); \
79             return (val); \
80         } \
81     } while(0)
82 #define warn_if(expr) \
83     do { \
84         if (expr) { \
85             WARN("(%s)", #expr); \
86         } \
87     } while (0)
88
89
90
91 #define BT_ERROR_CHECK( _FUNC_ )        {                               \
92         bt_error_e __err__ = (bt_error_e)(_FUNC_);      \
93     if ( __err__ != BT_ERROR_NONE )                             \
94     {                                                                                                   \
95         what_return_value( __err__ );                               \
96         goto BT_ERROR;                                              \
97     }                                                                               \
98 }
99
100
101 #endif //__OICAPP_LOG_H__
102