Friendly LWM2M client
WppLogs.h
Go to the documentation of this file.
1 #ifndef WPP_LOGS_H
2 #define WPP_LOGS_H
3 
4 #include "WppPlatform.h"
5 #include "liblwm2m.h"
6 
7 /* ---------- WPP components log TAGs start ---------- */
8 #define TAG_WPP_CLIENT "WppClient"
9 #define TAG_WPP_CONN "WppConnection"
10 #define TAG_WPP_REG "WppRegistry"
11 #define TAG_WPP_OBJ "Object"
12 #define TAG_WPP_INST "Instance"
13 #define TAG_WPP_RES "Resource"
14 #define TAG_WPP_RES_CON "ResourceContainer"
15 #define TAG_WPP_TASK "WppTaskQueue"
16 /* ---------- WPP components log TAGs end ---------- */
17 
18 /* ---------- Logs config start ---------- */
19 #define WPP_LOGS_LEVEL_DEBUG 0
20 #define WPP_LOGS_LEVEL_INFO 1
21 #define WPP_LOGS_LEVEL_WARNING 2
22 #define WPP_LOGS_LEVEL_ERROR 3
23 #ifndef WPP_LOGS_LEVEL
24  #define WPP_LOGS_LEVEL WPP_LOGS_LEVEL_DEBUG
25 #endif
26 /* ---------- Logs config end ---------- */
27 
28 #if defined(WPP_ENABLE_LOGS) && WPP_LOGS_LEVEL <= WPP_LOGS_LEVEL_DEBUG
29  #define WPP_LOGD(TAG, FMT, ...) wpp::WppPlatform::print("[wpp:%s] [%s():%d] [DEBUG] " FMT "\r\n", TAG, __func__ , __LINE__ , ##__VA_ARGS__)
30 #else
31  #define WPP_LOGD(TAG, FMT, ...)
32 #endif
33 
34 #if defined(WPP_ENABLE_LOGS) && WPP_LOGS_LEVEL <= WPP_LOGS_LEVEL_INFO
35  #define WPP_LOGI(TAG, FMT, ...) wpp::WppPlatform::print("[wpp:%s] [%s():%d] [INFO] " FMT "\r\n", TAG, __func__ , __LINE__ , ##__VA_ARGS__)
36 #else
37  #define WPP_LOGI(TAG, FMT, ...)
38 #endif
39 
40 #if defined(WPP_ENABLE_LOGS) && WPP_LOGS_LEVEL <= WPP_LOGS_LEVEL_WARNING
41  #define WPP_LOGW(TAG, FMT, ...) wpp::WppPlatform::print("[wpp:%s] [%s():%d] [WARNING] " FMT "\r\n", TAG, __func__ , __LINE__ , ##__VA_ARGS__)
42 #else
43  #define WPP_LOGW(TAG, FMT, ...)
44 #endif
45 
46 #if defined(WPP_ENABLE_LOGS) && WPP_LOGS_LEVEL <= WPP_LOGS_LEVEL_ERROR
47  #define WPP_LOGE(TAG, FMT, ...) wpp::WppPlatform::print("[wpp:%s] [%s():%d] [ERROR] " FMT "\r\n", TAG, __func__ , __LINE__ , ##__VA_ARGS__)
48 #else
49  #define WPP_LOGE(TAG, FMT, ...)
50 #endif
51 
52 #endif //WPP_LOGS_H