Skip to content

Update esp32-hal-log.h #6351

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cores/esp32/esp32-hal-log.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ void log_print_buf(const uint8_t *b, size_t len);
#define isr_log_e(format, ...) ets_printf(ARDUHAL_LOG_FORMAT(E, format), ##__VA_ARGS__)
#define log_buf_e(b,l) do{ARDUHAL_LOG_COLOR_PRINT(E);log_print_buf(b,l);ARDUHAL_LOG_COLOR_PRINT_END;}while(0)
#else
#define log_e(format, ...) do {log_to_esp(TAG, ESP_LOG_ERROR, format, ##__VA_ARGS__);}while(0)
#define log_e(format, ...) do {ESP_LOG_LEVEL_LOCAL(ESP_LOG_ERROR, TAG, format, ##__VA_ARGS__);}while(0)
#define isr_log_e(format, ...) do {ets_printf(LOG_FORMAT(E, format), esp_log_timestamp(), TAG, ##__VA_ARGS__);}while(0)
#define log_buf_e(b,l) do {ESP_LOG_BUFFER_HEXDUMP(TAG, b, l, ESP_LOG_ERROR);}while(0)
#endif
Expand Down Expand Up @@ -187,9 +187,9 @@ void log_print_buf(const uint8_t *b, size_t len);
#include "esp_log.h"

#ifdef USE_ESP_IDF_LOG
#ifndef TAG
#define TAG "ARDUINO"
#endif
//#ifndef TAG
//#define TAG "ARDUINO"
//#endif
Copy link
Contributor

@ankostis ankostis Apr 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was it intentional the commenting-out of the 3 LoCs defaulting the TAG for arduino log-statements that lack this arg?

I think that after this PR, if DUSE_ESP_IDF_LOG defined,
i MUST add this build_flag -DTAG='"arduino"' myself,
or the compile screams.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the error i'm getting without TAG defined in the build_flags:

~/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-log.h:163:67: error: 'TAG' was not declared in this scope
 #define log_e(format, ...) do {ESP_LOG_LEVEL_LOCAL(ESP_LOG_ERROR, TAG, format, ##__VA_ARGS__);}while(0)
                                                                   ^~~
~/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/log/include/esp_log.h:421:81: note: in definition of macro 'ESP_LOG_LEVEL'
         if (level==ESP_LOG_ERROR )          { esp_log_write(ESP_LOG_ERROR,      tag, LOG_FORMAT(E, format), esp_log_timestamp(), tag, ##__VA_ARGS__); } \
                                                                                 ^~~
~/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-log.h:163:32: note: in expansion of macro 'ESP_LOG_LEVEL_LOCAL'
 #define log_e(format, ...) do {ESP_LOG_LEVEL_LOCAL(ESP_LOG_ERROR, TAG, format, ##__VA_ARGS__);}while(0)
                                ^~~~~~~~~~~~~~~~~~~
~/.platformio/packages/framework-arduinoespressif32/libraries/WiFi/src/WiFiAP.cpp:168:10: note: in expansion of macro 'log_e'
          log_e("set AP config failed");
          ^~~~~

Should i open an issue about it?

//#define log_n(format, ...) myLog(ESP_LOG_NONE, format, ##__VA_ARGS__)
#else
#ifdef CONFIG_ARDUHAL_ESP_LOG
Expand Down