Skip to content

Commit

Permalink
Nimble: Fix logging level mismatch
Browse files Browse the repository at this point in the history
Added fix for two issues:
1. Fix C++ compilation issue due to automatic conversion between int and
esp_error_level_t
2. Use correct level macros to use system wide logging scheme
  • Loading branch information
rahult-github authored and ESPAbhinav committed Feb 14, 2024
1 parent 1348149 commit deb0976
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions porting/nimble/include/modlog/modlog.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,23 @@

#ifdef ESP_PLATFORM
#define MODLOG_ESP_LOCAL(level, ml_msg_, ...) do { \
if (MYNEWT_VAL(BLE_HS_LOG_LVL) <= level) esp_log_write(level, "NimBLE", ml_msg_, ##__VA_ARGS__); \
if (MYNEWT_VAL(BLE_HS_LOG_LVL) <= LOG_LOCAL_LEVEL) ESP_LOG_LEVEL_LOCAL(level, "NimBLE", ml_msg_, ##__VA_ARGS__); \
} while(0)

#define MODLOG_DEBUG(ml_mod_, ml_msg_, ...) \
MODLOG_ESP_LOCAL(LOG_LEVEL_DEBUG, ml_msg_, ##__VA_ARGS__)
MODLOG_ESP_LOCAL(ESP_LOG_DEBUG, ml_msg_, ##__VA_ARGS__)

#define MODLOG_INFO(ml_mod_, ml_msg_, ...) \
MODLOG_ESP_LOCAL(LOG_LEVEL_INFO, ml_msg_, ##__VA_ARGS__)
MODLOG_ESP_LOCAL(ESP_LOG_INFO, ml_msg_, ##__VA_ARGS__)

#define MODLOG_WARN(ml_mod_, ml_msg_, ...) \
MODLOG_ESP_LOCAL(LOG_LEVEL_WARN, ml_msg_, ##__VA_ARGS__)
MODLOG_ESP_LOCAL(ESP_LOG_WARN, ml_msg_, ##__VA_ARGS__)

#define MODLOG_ERROR(ml_mod_, ml_msg_, ...) \
MODLOG_ESP_LOCAL(LOG_LEVEL_ERROR, ml_msg_, ##__VA_ARGS__)
MODLOG_ESP_LOCAL(ESP_LOG_ERROR, ml_msg_, ##__VA_ARGS__)

#define MODLOG_CRITICAL(ml_mod_, ml_msg_, ...) \
MODLOG_ESP_LOCAL(LOG_LEVEL_CRITICAL, ml_msg_, ##__VA_ARGS__)
MODLOG_ESP_LOCAL(ESP_LOG_ERROR, ml_msg_, ##__VA_ARGS__)

#else

Expand Down

0 comments on commit deb0976

Please sign in to comment.