From caaf62bdad965e6b58bba74171986414057f6757 Mon Sep 17 00:00:00 2001 From: Chen Yi Qun Date: Wed, 29 Jul 2020 20:46:37 +0800 Subject: [PATCH] driver, http_client, web_socket, tcp_transport: remove __FILE__ from log messages __FILE__ macro in the error messages adds full paths to the production binarys, remove __FILE__ from the ESP_LOGE. Closes https://github.com/espressif/esp-idf/issues/5637 Merges https://github.com/espressif/esp-idf/pull/5638 --- components/driver/adc_common.c | 4 ++-- components/driver/dac.c | 4 ++-- components/driver/esp32/adc.c | 4 ++-- components/driver/esp32/touch_sensor.c | 2 +- components/driver/esp32s2/adc.c | 2 +- components/driver/esp32s2/rtc_tempsensor.c | 2 +- components/driver/esp32s2/touch_sensor.c | 2 +- components/driver/i2c.c | 4 ++-- components/driver/i2s.c | 2 +- components/driver/mcpwm.c | 4 ++-- components/driver/rtc_io.c | 2 +- components/driver/sdio_slave.c | 4 ++-- components/driver/sigmadelta.c | 6 +++--- components/driver/touch_sensor_common.c | 4 ++-- components/esp_http_client/lib/include/http_utils.h | 2 +- components/esp_websocket_client/esp_websocket_client.c | 2 +- .../tcp_transport/private_include/esp_transport_utils.h | 4 ++-- 17 files changed, 27 insertions(+), 27 deletions(-) diff --git a/components/driver/adc_common.c b/components/driver/adc_common.c index e11c5d5aff..b8cdc7b8b9 100644 --- a/components/driver/adc_common.c +++ b/components/driver/adc_common.c @@ -44,7 +44,7 @@ static const char *ADC_TAG = "ADC"; #define ADC_CHECK(a, str, ret_val) ({ \ if (!(a)) { \ - ESP_LOGE(ADC_TAG,"%s:%d (%s):%s", __FILE__, __LINE__, __FUNCTION__, str); \ + ESP_LOGE(ADC_TAG,"%s(%d): %s", __FUNCTION__, __LINE__, str); \ return (ret_val); \ } \ }) @@ -567,4 +567,4 @@ esp_err_t adc_vref_to_gpio(adc_unit_t adc_unit, gpio_num_t gpio) //Configure RTC gpio, Only ADC2's channels IO are supported to output reference voltage. adc_gpio_init(ADC_UNIT_2, ch); return ESP_OK; -} \ No newline at end of file +} diff --git a/components/driver/dac.c b/components/driver/dac.c index 58c3d26c64..609da1d79d 100644 --- a/components/driver/dac.c +++ b/components/driver/dac.c @@ -30,7 +30,7 @@ static const char *DAC_TAG = "DAC"; #define DAC_CHECK(a, str, ret_val) ({ \ if (!(a)) { \ - ESP_LOGE(DAC_TAG,"%s:%d (%s):%s", __FILE__, __LINE__, __FUNCTION__, str); \ + ESP_LOGE(DAC_TAG,"%s(%d): %s", __FUNCTION__, __LINE__, str); \ return (ret_val); \ } \ }) @@ -152,4 +152,4 @@ esp_err_t dac_cw_generator_config(dac_cw_config_t *cw) portEXIT_CRITICAL(&rtc_spinlock); return ESP_OK; -} \ No newline at end of file +} diff --git a/components/driver/esp32/adc.c b/components/driver/esp32/adc.c index b95f23f894..cdd4448c6c 100644 --- a/components/driver/esp32/adc.c +++ b/components/driver/esp32/adc.c @@ -57,7 +57,7 @@ static const char *ADC_TAG = "ADC"; #define ADC_CHECK(a, str, ret_val) ({ \ if (!(a)) { \ - ESP_LOGE(ADC_TAG,"%s:%d (%s):%s", __FILE__, __LINE__, __FUNCTION__, str); \ + ESP_LOGE(ADC_TAG,"%s(%d): %s", __FUNCTION__, __LINE__, str); \ return (ret_val); \ } \ }) @@ -161,4 +161,4 @@ int hall_sensor_read(void) adc1_config_channel_atten(ADC1_CHANNEL_0, ADC_ATTEN_DB_0); adc1_config_channel_atten(ADC1_CHANNEL_3, ADC_ATTEN_DB_0); return hall_sensor_get_value(); -} \ No newline at end of file +} diff --git a/components/driver/esp32/touch_sensor.c b/components/driver/esp32/touch_sensor.c index 61aeee769e..f04c039f85 100644 --- a/components/driver/esp32/touch_sensor.c +++ b/components/driver/esp32/touch_sensor.c @@ -59,7 +59,7 @@ static SemaphoreHandle_t rtc_touch_mux = NULL; static const char *TOUCH_TAG = "TOUCH_SENSOR"; #define TOUCH_CHECK(a, str, ret_val) ({ \ if (!(a)) { \ - ESP_LOGE(TOUCH_TAG,"%s:%d (%s):%s", __FILE__, __LINE__, __FUNCTION__, str); \ + ESP_LOGE(TOUCH_TAG,"%s(%d): %s", __FUNCTION__, __LINE__, str); \ return (ret_val); \ } \ }) diff --git a/components/driver/esp32s2/adc.c b/components/driver/esp32s2/adc.c index db85300c1a..937785248f 100644 --- a/components/driver/esp32s2/adc.c +++ b/components/driver/esp32s2/adc.c @@ -43,7 +43,7 @@ static const char *ADC_TAG = "ADC"; #define ADC_CHECK(a, str, ret_val) ({ \ if (!(a)) { \ - ESP_LOGE(ADC_TAG,"%s:%d (%s):%s", __FILE__, __LINE__, __FUNCTION__, str); \ + ESP_LOGE(ADC_TAG,"%s(%d): %s", __FUNCTION__, __LINE__, str); \ return (ret_val); \ } \ }) diff --git a/components/driver/esp32s2/rtc_tempsensor.c b/components/driver/esp32s2/rtc_tempsensor.c index cdf15d12a0..6855b825cc 100644 --- a/components/driver/esp32s2/rtc_tempsensor.c +++ b/components/driver/esp32s2/rtc_tempsensor.c @@ -29,7 +29,7 @@ static const char *TAG = "tsens"; #define TSENS_CHECK(res, ret_val) ({ \ if (!(res)) { \ - ESP_LOGE(TAG, "%s:%d (%s)", __FILE__, __LINE__, __FUNCTION__); \ + ESP_LOGE(TAG, "%s(%d)", __FUNCTION__, __LINE__); \ return (ret_val); \ } \ }) diff --git a/components/driver/esp32s2/touch_sensor.c b/components/driver/esp32s2/touch_sensor.c index 3c15817127..f9aa9baca1 100644 --- a/components/driver/esp32s2/touch_sensor.c +++ b/components/driver/esp32s2/touch_sensor.c @@ -45,7 +45,7 @@ static const char *TOUCH_TAG = "TOUCH_SENSOR"; #define TOUCH_CHECK(a, str, ret_val) ({ \ if (!(a)) { \ - ESP_LOGE(TOUCH_TAG,"%s:%d (%s):%s", __FILE__, __LINE__, __FUNCTION__, str); \ + ESP_LOGE(TOUCH_TAG,"%s(%d): %s", __FUNCTION__, __LINE__, str); \ return (ret_val); \ } \ }) diff --git a/components/driver/i2c.c b/components/driver/i2c.c index b14cf23104..25a68907dc 100644 --- a/components/driver/i2c.c +++ b/components/driver/i2c.c @@ -35,8 +35,8 @@ static const char *I2C_TAG = "i2c"; #define I2C_CHECK(a, str, ret) if(!(a)) { \ - ESP_LOGE(I2C_TAG,"%s:%d (%s):%s", __FILE__, __LINE__, __FUNCTION__, str); \ - return (ret); \ + ESP_LOGE(I2C_TAG,"%s(%d): %s", __FUNCTION__, __LINE__, str); \ + return (ret); \ } /* DRAM_ATTR is required to avoid I2C array placed in flash, due to accessed from ISR */ diff --git a/components/driver/i2s.c b/components/driver/i2s.c index a8a0cb87eb..05ff802a0f 100644 --- a/components/driver/i2s.c +++ b/components/driver/i2s.c @@ -43,7 +43,7 @@ static const char* I2S_TAG = "I2S"; #define I2S_CHECK(a, str, ret) if (!(a)) { \ - ESP_LOGE(I2S_TAG,"%s:%d (%s):%s", __FILE__, __LINE__, __FUNCTION__, str); \ + ESP_LOGE(I2S_TAG,"%s(%d): %s", __FUNCTION__, __LINE__, str); \ return (ret); \ } diff --git a/components/driver/mcpwm.c b/components/driver/mcpwm.c index bbd6e96739..f608b91fa6 100644 --- a/components/driver/mcpwm.c +++ b/components/driver/mcpwm.c @@ -42,8 +42,8 @@ typedef struct { static const char *MCPWM_TAG = "MCPWM"; #define MCPWM_CHECK(a, str, ret_val) if (!(a)) { \ - ESP_LOGE(MCPWM_TAG,"%s:%d (%s):%s", __FILE__, __LINE__, __FUNCTION__, str); \ - return (ret_val); \ + ESP_LOGE(MCPWM_TAG,"%s(%d): %s", __FUNCTION__, __LINE__, str); \ + return (ret_val); \ } #define MCPWM_DRIVER_INIT_ERROR "MCPWM DRIVER NOT INITIALIZED" diff --git a/components/driver/rtc_io.c b/components/driver/rtc_io.c index f851129f22..16b4bc9adf 100644 --- a/components/driver/rtc_io.c +++ b/components/driver/rtc_io.c @@ -25,7 +25,7 @@ static const char *RTCIO_TAG = "RTCIO"; #define RTCIO_CHECK(a, str, ret_val) ({ \ if (!(a)) { \ - ESP_LOGE(RTCIO_TAG,"%s:%d (%s):%s", __FILE__, __LINE__, __FUNCTION__, str); \ + ESP_LOGE(RTCIO_TAG,"%s(%d): %s", __FUNCTION__, __LINE__, str); \ return (ret_val); \ } \ }) diff --git a/components/driver/sdio_slave.c b/components/driver/sdio_slave.c index b346e5c6b2..ccc1c0ada7 100644 --- a/components/driver/sdio_slave.c +++ b/components/driver/sdio_slave.c @@ -107,7 +107,7 @@ The driver of FIFOs works as below: static const char TAG[] = "sdio_slave"; -#define SDIO_SLAVE_LOGE(s, ...) ESP_LOGE(TAG, "%s:%d (%s):"s, __FILE__,__LINE__,__FUNCTION__,##__VA_ARGS__) +#define SDIO_SLAVE_LOGE(s, ...) ESP_LOGE(TAG, "%s(%d): "s, __FUNCTION__,__LINE__,##__VA_ARGS__) #define SDIO_SLAVE_LOGW(s, ...) ESP_LOGW(TAG, "%s: "s, __FUNCTION__,##__VA_ARGS__) @@ -746,4 +746,4 @@ uint8_t* sdio_slave_recv_get_buf(sdio_slave_buf_handle_t handle, size_t *len_o) if (len_o!= NULL) *len_o= desc->hal_desc.length; return (uint8_t*)desc->hal_desc.buf; -} \ No newline at end of file +} diff --git a/components/driver/sigmadelta.c b/components/driver/sigmadelta.c index ce2d4eb288..d2e480dc89 100644 --- a/components/driver/sigmadelta.c +++ b/components/driver/sigmadelta.c @@ -21,9 +21,9 @@ static const char *TAG = "SIGMADELTA"; -#define SIGMADELTA_CHECK(a,str,ret_val) if(!(a)) { \ - ESP_LOGE(TAG,"%s:%d (%s):%s", __FILE__, __LINE__, __FUNCTION__, str); \ - return (ret_val); \ +#define SIGMADELTA_CHECK(a,str,ret_val) if(!(a)) { \ + ESP_LOGE(TAG,"%s(%d): %s", __FUNCTION__, __LINE__, str); \ + return (ret_val); \ } typedef struct { diff --git a/components/driver/touch_sensor_common.c b/components/driver/touch_sensor_common.c index f8464b0fcc..e5bbc74906 100644 --- a/components/driver/touch_sensor_common.c +++ b/components/driver/touch_sensor_common.c @@ -34,7 +34,7 @@ static const char *TOUCH_TAG = "TOUCH_SENSOR"; #define TOUCH_CHECK(a, str, ret_val) ({ \ if (!(a)) { \ - ESP_LOGE(TOUCH_TAG,"%s:%d (%s):%s", __FILE__, __LINE__, __FUNCTION__, str); \ + ESP_LOGE(TOUCH_TAG,"%s(%d): %s", __FUNCTION__, __LINE__, str); \ return (ret_val); \ } \ }) @@ -243,4 +243,4 @@ esp_err_t IRAM_ATTR touch_pad_clear_status(void) { touch_hal_clear_trigger_status_mask(); return ESP_OK; -} \ No newline at end of file +} diff --git a/components/esp_http_client/lib/include/http_utils.h b/components/esp_http_client/lib/include/http_utils.h index 14c3b10c4e..c8183957c7 100644 --- a/components/esp_http_client/lib/include/http_utils.h +++ b/components/esp_http_client/lib/include/http_utils.h @@ -81,7 +81,7 @@ int http_utils_str_starts_with(const char *str, const char *start); #define HTTP_MEM_CHECK(TAG, a, action) if (!(a)) { \ - ESP_LOGE(TAG,"%s:%d (%s): %s", __FILE__, __LINE__, __FUNCTION__, "Memory exhausted"); \ + ESP_LOGE(TAG,"%s(%d): %s", __FUNCTION__, __LINE__, "Memory exhausted"); \ action; \ } diff --git a/components/esp_websocket_client/esp_websocket_client.c b/components/esp_websocket_client/esp_websocket_client.c index 82520c624e..5059e36dd2 100644 --- a/components/esp_websocket_client/esp_websocket_client.c +++ b/components/esp_websocket_client/esp_websocket_client.c @@ -42,7 +42,7 @@ static const char *TAG = "WEBSOCKET_CLIENT"; #define WEBSOCKET_PINGPONG_TIMEOUT_SEC (120) #define ESP_WS_CLIENT_MEM_CHECK(TAG, a, action) if (!(a)) { \ - ESP_LOGE(TAG,"%s:%d (%s): %s", __FILE__, __LINE__, __FUNCTION__, "Memory exhausted"); \ + ESP_LOGE(TAG,"%s(%d): %s", __FUNCTION__, __LINE__, "Memory exhausted"); \ action; \ } diff --git a/components/tcp_transport/private_include/esp_transport_utils.h b/components/tcp_transport/private_include/esp_transport_utils.h index dbc91b1190..2aa95119d8 100644 --- a/components/tcp_transport/private_include/esp_transport_utils.h +++ b/components/tcp_transport/private_include/esp_transport_utils.h @@ -25,7 +25,7 @@ extern "C" { * */ #define ESP_TRANSPORT_MEM_CHECK(TAG, a, action) if (!(a)) { \ - ESP_LOGE(TAG,"%s:%d (%s): %s", __FILE__, __LINE__, __FUNCTION__, "Memory exhausted"); \ + ESP_LOGE(TAG,"%s(%d): %s", __FUNCTION__, __LINE__, "Memory exhausted"); \ action; \ } @@ -46,4 +46,4 @@ struct timeval* esp_transport_utils_ms_to_timeval(int timeout_ms, struct timeval #ifdef __cplusplus } #endif -#endif /* _ESP_TRANSPORT_UTILS_H_ */ \ No newline at end of file +#endif /* _ESP_TRANSPORT_UTILS_H_ */