-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
esp32-hal-log.h macros not usable by default #893
Comments
these debug levels can be set at compile by selecting "ESP32 Dev Module" as your board under tools, If you want to add these options to your specific board, in boards.txt
Replace the
Chuck. |
@stickbreaker unfortunate PlatformIO does not have a tools menu and I have "esp32dev" as the board type. Even if I was using the Arduino IDE, how does the sdkconfig.h get updated? Does it override it during the build somehow? |
Yea, when those options are selected, they are passed into the build as command line args. I don't know PlatformIO maybe @me-no-dev, can direct you. Chuck. |
@stickbreaker can you post an example of the commandline? I can try and convert it to PlatformIO. |
Here is from my latest compile. I think you want
in platform.txt:
is this what you want? Chuck. |
@atanisoft |
Thanks @stickbreaker and @beegee-tokyo. That does seem to work, is there a way to split it up so the core logging is at a different level than say application code that also uses log_X? |
@atanisoft |
@beegee-tokyo I think you are right. The ESP-IDF logging API has a "tag" which can be used to set specific log levels for each tag, unfortunately the HAL log wrappers are discarding that tag in the ESP_LOGE and other macros. I am guessing without a bit of work on the HAL layer to expose the tag/log level/etc pieces from the lower levels it won't work cleanly. One other aspect I haven't been able to sort out with PlatformIO is enabling CONFIG_ARDUHAL_LOG_COLORS. The serial monitor seems to just print the ANSI codes rather than interpret them. I am guessing this is likely a setting in PlatformIO that is incorrect as well as a missing configuration in the Windows Power Shell used by PlatformIO. Any thoughts on that? |
@atanisoft regarding CONFIG_ARDUHAL_LOG_COLORS I think it is depending on the serial terminal program you use. I never use the PlatformIO terminal but instead I use Termite. But that doesn't support coloring as well. It just suppresses the color codes. |
@beegee-tokyo PlatformIO uses MiniTerm IIRC. I fired up MTPuTTY and the colors work there :) The only downside of an external terminal is having to remember to close it before uploading but that is minor. |
@atanisoft will try MiniTerm IIRC. Maybe you can close this issue now. |
@beegee-tokyo I agree, this should likely get closed as it is not an issue but certainly this should be documented somewhere. |
@beegee-tokyo I agree ;) poke me tomorrow to see what I can do to give you access to that |
hate to resurface the issue, but based on the code line 139 https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-log.h , the setting of CONFIG_ARDUHAL_ESP_LOG=1 should direct the execution to esp_log.h |
Any update on Platform IO ? Update, I put this on my platformio.ini file:
|
@atanisoft to view color logs, you must instruct MiniTerm to display chars received in raw, with this in your [env]
monitor_filters = direct ; to view colored logs, if enabled with `-DCONFIG_ARDUHAL_LOG_COLORS` or ` Alternatively, launch the monitor command directly from your OS's terminal (if working with a POSIX host): pio device monitor` |
thanks @ankostis, I'll keep that in mind if I use PIO in the future. I've mostly moved to native ESP-IDF cmake/idf.py at this point for my projects since PIO doesn't fully support the latest ESP-IDF or arduino-esp32 code yet. |
Hardware:
Board: ESP32 Dev Module
Core Installation/update date: 29/Nov/2017
IDE name: Platform.io
Flash Frequency: 40Mhz
Upload Speed: 115200
Description:
The macros defined in esp32-hal-log.h are not usable due to sdkconfig.h having CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL set to 0 (NONE). It would be good if this could be configured at project level.
Sketch:
In the above the "test output" lines will not be displayed on serial. The only solution I have found is modify sdkconfig.h to comment out the definition of CONFIG_ARDUHAL_LOG_DEFAULT_LEVEL and pass this in via -DCONFIG_ARDUHAL_LOG_DEFAULT_LEVEL=XXXX in platformio.ini, very likely the Arduino IDE will behave similarly.
The text was updated successfully, but these errors were encountered: