1 /******************************************************************
3 * Copyright 2014 Samsung Electronics All Rights Reserved.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 ******************************************************************/
20 #ifndef __OICAPP_LOG_H__
21 #define __OICAPP_LOG_H__
23 #define TIZEN_DEBUG_ENABLE
24 #define LOG_TAG "OIC_TEST"
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"
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)
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)
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)
54 #define ret_if(expr) \
61 #define retv_if(expr, val) \
68 #define retm_if(expr, fmt, arg...) \
75 #define retvm_if(expr, val, fmt, arg...) \
82 #define warn_if(expr) \
85 WARN("(%s)", #expr); \
91 #define BT_ERROR_CHECK( _FUNC_ ) { \
92 bt_error_e __err__ = (bt_error_e)(_FUNC_); \
93 if ( __err__ != BT_ERROR_NONE ) \
95 what_return_value( __err__ ); \
101 #endif //__OICAPP_LOG_H__