[sample] fix details
[apps/native/iot-device-manager.git] / inc / log.h
1 /*
2  * log.h
3  *
4  *  Created on: Sep 19, 2018
5  *      Author: simplatform
6  */
7
8 #ifndef __LOG_H__
9 #define __LOG_H__
10
11 #include <dlog.h>
12
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16
17 #ifdef LOG_TAG
18 #undef LOG_TAG
19 #endif
20 #define LOG_TAG "DM"
21
22 #define _E(fmt, args...) dlog_print(DLOG_ERROR, LOG_TAG, "%s : %s(%d) > " fmt" \n", rindex(__FILE__, '/') + 1, __func__, __LINE__, ##args)
23 #define _W(fmt, args...) dlog_print(DLOG_WARN, LOG_TAG, "%s : %s(%d) > " fmt" \n", rindex(__FILE__, '/') + 1, __func__, __LINE__, ##args)
24 #define _I(fmt, args...) dlog_print(DLOG_INFO, LOG_TAG, "%s : %s(%d) > " fmt" \n", rindex(__FILE__, '/') + 1, __func__, __LINE__, ##args)
25 #define _D(fmt, args...) dlog_print(DLOG_DEBUG, LOG_TAG, "%s : %s(%d) > " fmt" \n", rindex(__FILE__, '/') + 1, __func__, __LINE__, ##args)
26
27 #define FN_CALL dlog_print(DLOG_DEBUG, LOG_TAG, ">>>>>>>> called")
28 #define FN_END dlog_print(DLOG_DEBUG, LOG_TAG, "<<<<<<<< ended")
29
30 #define retv_if(expr, val) do { \
31         if (expr) { \
32                 dlog_print(DLOG_INFO, "%s : %s(%d) > (%s) -> %s() return", rindex(__FILE__, '/') + 1, __func__, __LINE__, #expr, __FUNCTION__); \
33                 return (val); \
34         } \
35 } while (0)
36
37 #define ret_if(expr) do { \
38         if (expr) { \
39                 dlog_print(DLOG_INFO, "%s : %s(%d) > (%s) -> %s() return", rindex(__FILE__, '/') + 1, __func__, __LINE__, #expr, __FUNCTION__); \
40                 return; \
41         } \
42 } while (0)
43
44
45
46 #ifdef __cplusplus
47 }
48 #endif
49
50 #endif /* __LOG_H__ */