110
110
111
111
# define NIMBLE_CPP_LOG_FORMAT (letter , format ) NIMBLE_CPP_LOG_COLOR_##letter #letter " (%lu) %s: " format LOG_RESET_COLOR "\n"
112
112
113
- # define NIMBLE_CPP_LOG_LEVEL_LOCAL (level , tag , format , ...) \
114
- do { \
115
- if (level==ESP_LOG_ERROR) { esp_log_write(ESP_LOG_ERROR, tag, NIMBLE_CPP_LOG_FORMAT(E, format), esp_log_timestamp(), tag __VA_OPT__(,) __VA_ARGS__); } \
113
+ # define NIMBLE_CPP_LOG_LEVEL_LOCAL (level , tag , format , ...) \
114
+ do { \
115
+ if (level==ESP_LOG_ERROR) { esp_log_write(ESP_LOG_ERROR, tag, NIMBLE_CPP_LOG_FORMAT(E, format), esp_log_timestamp(), tag __VA_OPT__(,) __VA_ARGS__); } \
116
116
else if (level==ESP_LOG_WARN) { esp_log_write(ESP_LOG_WARN, tag, NIMBLE_CPP_LOG_FORMAT(W, format), esp_log_timestamp(), tag __VA_OPT__(,) __VA_ARGS__); } \
117
117
else if (level==ESP_LOG_INFO) { esp_log_write(ESP_LOG_INFO, tag, NIMBLE_CPP_LOG_FORMAT(I, format), esp_log_timestamp(), tag __VA_OPT__(,) __VA_ARGS__); } \
118
118
else { esp_log_write(ESP_LOG_DEBUG, tag, NIMBLE_CPP_LOG_FORMAT(D, format), esp_log_timestamp(), tag __VA_OPT__(,) __VA_ARGS__); } \
119
119
} while(0)
120
120
121
- # define NIMBLE_CPP_LOG_PRINT (level , tag , format , ...) \
122
- do { \
121
+ # define NIMBLE_CPP_LOG_PRINT (level , tag , format , ...) \
122
+ do { \
123
123
if (CONFIG_NIMBLE_CPP_LOG_LEVEL >= level) NIMBLE_CPP_LOG_LEVEL_LOCAL(level, tag, format, ##__VA_ARGS__); \
124
124
} while (0)
125
125
172
172
# endif
173
173
174
174
# endif /* CONFIG_NIMBLE_CPP_IDF */
175
+
176
+ # define NIMBLE_LOGD_IF (cond , tag , format , ...) { if (cond) { NIMBLE_LOGD(tag, format, ##__VA_ARGS__); }}
177
+ # define NIMBLE_LOGI_IF (cond , tag , format , ...) { if (cond) { NIMBLE_LOGI(tag, format, ##__VA_ARGS__); }}
178
+ # define NIMBLE_LOGW_IF (cond , tag , format , ...) { if (cond) { NIMBLE_LOGW(tag, format, ##__VA_ARGS__); }}
179
+ # define NIMBLE_LOGE_IF (cond , tag , format , ...) { if (cond) { NIMBLE_LOGE(tag, format, ##__VA_ARGS__); }}
180
+ # define NIMBLE_LOGE_RC (rc , tag , format , ...) { if (rc) { NIMBLE_LOGE(tag, format "; rc=%d %s", ##__VA_ARGS__, rc, NimBLEUtils::returnCodeToString(rc)); }}
181
+
175
182
#endif /* CONFIG_BT_ENABLED */
176
183
#endif /* NIMBLE_CPP_LOG_H_ */
0 commit comments