2 * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 #ifndef __IOT_CONNECTIVITY_MANAGER_INTERNAL_LOG_H__
17 #define __IOT_CONNECTIVITY_MANAGER_INTERNAL_LOG_H__
19 #define IC_LOG_RED "\033[0;31m"
20 #define IC_LOG_GREEN "\033[0;32m"
21 #define IC_LOG_BROWN "\033[0;33m"
22 #define IC_LOG_BLUE "\033[0;34m"
23 #define IC_LOG_END "\033[0;m"
35 #define TIZEN_DEBUG_ENABLE
36 #define LOG_TAG "IOTCON"
41 #define _DBG(fmt, arg...) SLOGD(IC_LOG_GREEN "<Daemon>" IC_LOG_END fmt, ##arg)
42 #define _INFO(fmt, arg...) SLOGI(IC_LOG_GREEN "<Daemon>" IC_LOG_END fmt, ##arg)
43 #define _WARN(fmt, arg...) SLOGW(IC_LOG_GREEN "<Daemon>" IC_LOG_END fmt, ##arg)
44 #define _ERR(fmt, arg...) SLOGE(IC_LOG_GREEN "<Daemon>" IC_LOG_END fmt, ##arg)
48 #define _DBG(fmt, arg...) SLOGD(fmt, ##arg)
49 #define _INFO(fmt, arg...) SLOGI(fmt, ##arg)
50 #define _WARN(fmt, arg...) SLOGW(fmt, ##arg)
51 #define _ERR(fmt, arg...) SLOGE(fmt, ##arg)
53 #endif /* IC_DAEMON */
56 #define _DBG(fmt, arg...) \
57 printf("[IoTCon]%s(%d):" fmt "\n", __FUNCTION__, __LINE__, ##arg)
58 #define _INFO(fmt, arg...) \
59 printf("[IoTCon]%s(%d):" fmt "\n", __FUNCTION__, __LINE__, ##arg)
60 #define _WARN(fmt, arg...) \
61 printf("[IoTCon]%s(%d):" fmt "\n", __FUNCTION__, __LINE__, ##arg)
62 #define _ERR(fmt, arg...) \
63 printf("[IoTCon]%s(%d):" fmt "\n", __FUNCTION__, __LINE__, ##arg)
70 #define FN_CALL _INFO(">>>>>>>> called")
71 #define FN_END _INFO("<<<<<<<< ended")
72 #define DBG(fmt, arg...) _DBG(fmt, ##arg)
73 #define WARN(fmt, arg...) _WARN(IC_LOG_BROWN fmt IC_LOG_END, ##arg)
74 #define ERR(fmt, arg...) _ERR(IC_LOG_RED fmt IC_LOG_END, ##arg)
75 #define INFO(fmt, arg...) _INFO(IC_LOG_BLUE fmt IC_LOG_END, ##arg)
76 #define SECURE_DBG(fmt, arg...) SECURE_SLOGD(fmt, ##arg)
77 #define SECURE_ERR(fmt, arg...) SECURE_SLOGE(fmt, ##arg)
80 #define DBG_HANDLE(handle) _DBG("handle : %lld", #handle)
82 #define DBG_HANDLE(handle) _DBG("handle : %d", #handle)
85 #else /* IC_DEBUGGING */
89 #define DBG(fmt, arg...)
90 #define WARN(fmt, arg...)
91 #define ERR(fmt, arg...) _ERR(fmt, ##arg)
92 #define INFO(fmt, arg...)
93 #define SECURE_DBG(fmt, arg...)
94 #define SECURE_ERR(fmt, arg...) SECURE_SLOGE(fmt, ##arg)
96 #endif /* IC_DEBUGGING */
98 #define RET_IF(expr) \
101 ERR("(%s)", #expr); \
106 #define RETV_IF(expr, val) \
109 ERR("(%s)", #expr); \
114 #define RETM_IF(expr, fmt, arg...) \
122 #define RETVM_IF(expr, val, fmt, arg...) \
130 #define ERR_IF(expr) \
133 ERR("(%s)", #expr); \
137 #define WARN_IF(expr, fmt, arg...) \
144 #endif /* __IOT_CONNECTIVITY_MANAGER_INTERNAL_LOG_H__ */