mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-07-29 18:27:15 +02:00
Allow use of log_x() in if (#5844)
if (1) log_e("error") produces a warning ("missing braces") and probably wrong code if no log level is defined. This fixes that.
This commit is contained in:
@ -99,9 +99,9 @@ void log_print_buf(const uint8_t *b, size_t len);
|
|||||||
#define log_buf_v(b,l) do {ESP_LOG_BUFFER_HEXDUMP(TAG, b, l, ESP_LOG_VERBOSE);}while(0)
|
#define log_buf_v(b,l) do {ESP_LOG_BUFFER_HEXDUMP(TAG, b, l, ESP_LOG_VERBOSE);}while(0)
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define log_v(format, ...)
|
#define log_v(format, ...) do {} while(0)
|
||||||
#define isr_log_v(format, ...)
|
#define isr_log_v(format, ...) do {} while(0)
|
||||||
#define log_buf_v(b,l)
|
#define log_buf_v(b,l) do {} while(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
|
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_DEBUG
|
||||||
@ -115,9 +115,9 @@ void log_print_buf(const uint8_t *b, size_t len);
|
|||||||
#define log_buf_d(b,l) do {ESP_LOG_BUFFER_HEXDUMP(TAG, b, l, ESP_LOG_DEBUG);}while(0)
|
#define log_buf_d(b,l) do {ESP_LOG_BUFFER_HEXDUMP(TAG, b, l, ESP_LOG_DEBUG);}while(0)
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define log_d(format, ...)
|
#define log_d(format, ...) do {} while(0)
|
||||||
#define isr_log_d(format, ...)
|
#define isr_log_d(format, ...) do {} while(0)
|
||||||
#define log_buf_d(b,l)
|
#define log_buf_d(b,l) do {} while(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO
|
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO
|
||||||
@ -131,9 +131,9 @@ void log_print_buf(const uint8_t *b, size_t len);
|
|||||||
#define log_buf_i(b,l) do {ESP_LOG_BUFFER_HEXDUMP(TAG, b, l, ESP_LOG_INFO);}while(0)
|
#define log_buf_i(b,l) do {ESP_LOG_BUFFER_HEXDUMP(TAG, b, l, ESP_LOG_INFO);}while(0)
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define log_i(format, ...)
|
#define log_i(format, ...) do {} while(0)
|
||||||
#define isr_log_i(format, ...)
|
#define isr_log_i(format, ...) do {} while(0)
|
||||||
#define log_buf_i(b,l)
|
#define log_buf_i(b,l) do {} while(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_WARN
|
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_WARN
|
||||||
@ -147,9 +147,9 @@ void log_print_buf(const uint8_t *b, size_t len);
|
|||||||
#define log_buf_w(b,l) do {ESP_LOG_BUFFER_HEXDUMP(TAG, b, l, ESP_LOG_WARN);}while(0)
|
#define log_buf_w(b,l) do {ESP_LOG_BUFFER_HEXDUMP(TAG, b, l, ESP_LOG_WARN);}while(0)
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define log_w(format, ...)
|
#define log_w(format, ...) do {} while(0)
|
||||||
#define isr_log_w(format, ...)
|
#define isr_log_w(format, ...) do {} while(0)
|
||||||
#define log_buf_w(b,l)
|
#define log_buf_w(b,l) do {} while(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_ERROR
|
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_ERROR
|
||||||
@ -163,9 +163,9 @@ void log_print_buf(const uint8_t *b, size_t len);
|
|||||||
#define log_buf_e(b,l) do {ESP_LOG_BUFFER_HEXDUMP(TAG, b, l, ESP_LOG_ERROR);}while(0)
|
#define log_buf_e(b,l) do {ESP_LOG_BUFFER_HEXDUMP(TAG, b, l, ESP_LOG_ERROR);}while(0)
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define log_e(format, ...)
|
#define log_e(format, ...) do {} while(0)
|
||||||
#define isr_log_e(format, ...)
|
#define isr_log_e(format, ...) do {} while(0)
|
||||||
#define log_buf_e(b,l)
|
#define log_buf_e(b,l) do {} while(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_NONE
|
#if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_NONE
|
||||||
@ -179,9 +179,9 @@ void log_print_buf(const uint8_t *b, size_t len);
|
|||||||
#define log_buf_n(b,l) do {ESP_LOG_BUFFER_HEXDUMP(TAG, b, l, ESP_LOG_ERROR);}while(0)
|
#define log_buf_n(b,l) do {ESP_LOG_BUFFER_HEXDUMP(TAG, b, l, ESP_LOG_ERROR);}while(0)
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define log_n(format, ...)
|
#define log_n(format, ...) do {} while(0)
|
||||||
#define isr_log_n(format, ...)
|
#define isr_log_n(format, ...) do {} while(0)
|
||||||
#define log_buf_n(b,l)
|
#define log_buf_n(b,l) do {} while(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
|
Reference in New Issue
Block a user