Enable log levels in PlatformIO

esp32-hal-log.h defines macros for log output depending on levels. By default the log level is set to 0 (no log enabled). To use the log macros for different levels the log level can be set

  • for all projects in platform.txt
  • for a specific project in platformio.ini

Set log level for all projects

Edit platform.txt (located in the packages folder) Search for the following sequence:

Change -DCORE_DEBUG_LEVEL={build.code_debug} to the desired log level

Set log level for a specific project

Edit platformio.ini (located in the project folder) Add (or extend) the build_flags option:build_flags = -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG

Example platformio.ini:

Available levels:

  • Error
  • Warning
  • Info
  • Debug
  • Verbose

Leave a Reply

Your email address will not be published. Required fields are marked *

Free Link Directory