mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-09-24 09:57:22 +00:00
porting: use macros for log level filtering
This reduces the size of the compiled binary by 7856 bytes. Merges https://github.com/espressif/esp-nimble/pull/6
This commit is contained in:
@@ -41,20 +41,24 @@ modlog_dummy(const char *msg, ...)
|
||||
#endif
|
||||
|
||||
#ifdef ESP_PLATFORM
|
||||
#define MODLOG_ESP_LOCAL(level, ml_msg_, ...) do { \
|
||||
if (LOG_LOCAL_LEVEL >= level) esp_log_write(level, "NimBLE", ml_msg_, ##__VA_ARGS__); \
|
||||
} while(0)
|
||||
|
||||
#define MODLOG_DEBUG(ml_mod_, ml_msg_, ...) \
|
||||
esp_log_write(ESP_LOG_DEBUG, "NimBLE",ml_msg_, ##__VA_ARGS__)
|
||||
MODLOG_ESP_LOCAL(ESP_LOG_DEBUG, ml_msg_, ##__VA_ARGS__)
|
||||
|
||||
#define MODLOG_INFO(ml_mod_, ml_msg_, ...) \
|
||||
esp_log_write(ESP_LOG_INFO, "NimBLE",ml_msg_, ##__VA_ARGS__)
|
||||
MODLOG_ESP_LOCAL(ESP_LOG_INFO, ml_msg_, ##__VA_ARGS__)
|
||||
|
||||
#define MODLOG_WARN(ml_mod_, ml_msg_, ...) \
|
||||
esp_log_write(ESP_LOG_WARN, "NimBLE",ml_msg_, ##__VA_ARGS__)
|
||||
MODLOG_ESP_LOCAL(ESP_LOG_WARN, ml_msg_, ##__VA_ARGS__)
|
||||
|
||||
#define MODLOG_ERROR(ml_mod_, ml_msg_, ...) \
|
||||
esp_log_write(ESP_LOG_ERROR, "NimBLE",ml_msg_, ##__VA_ARGS__)
|
||||
MODLOG_ESP_LOCAL(ESP_LOG_ERROR, ml_msg_, ##__VA_ARGS__)
|
||||
|
||||
#define MODLOG_CRITICAL(ml_mod_, ml_msg_, ...) \
|
||||
esp_log_write(ESP_LOG_ERROR, "NimBLE",ml_msg_, ##__VA_ARGS__)
|
||||
MODLOG_ESP_LOCAL(ESP_LOG_ERROR, ml_msg_, ##__VA_ARGS__)
|
||||
|
||||
#else
|
||||
|
||||
|
||||
Reference in New Issue
Block a user