Skip to content

Honor the ESP_LOGx logging macros #565

Closed
@nkolban

Description

@nkolban

The desire here is to create C++ source code that will compile and run as cleanly as possible under both the Arduino environment and the ESP-IDF environment. This specific issue relates to the use of the ESP_LOGx macros.

When writing C/C++ code in ESP-IDF, we use the macros ESP_LOGx() to write diagnostics to the serial console. The ESP_LOG macros have a number of variants each at a different level of logging such as ERROR, WARNING, VERBOSE, DEBUG etc. When compiled, the code will only log messages if they are at the configured level or higher. For example, ERROR level will not log WARNING. WARNING level will not log DEBUG. DEBUG level will not log VERBOSE etc.

The default in the Arduino environment is ERROR only.

There is a compile time directive found in the Arduino IDE that allows one to set a logging level. This results in a compilation time variable called CORE_DEBUG_LEVEL being set.

However ... and here is the punch line, the CORE_DEBUG_LEVEL does not affect the ESP_LOGx functions.

This issue asks that the setting of the CORE_DEBUG_LEVEL also affect the ESP_LOGx functions.

The source change for this is relatively straight forward but before making that change and issuing a pull-request, the purpose of this issue is to seek permission to make the change and issue a pull.

The logic suggestion would change the implementation of initArduino() to set the esp_log_level_set() flag as a function of the value of CORE_DEBUG_LEVEL. This code change would maintain status quo for existing Arduino logging but would embrace and engage ESP-IDF debug logging using ESP_LOGx() as part of the story.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions