alexCajas / EmbeddedMqttBroker

This is a Mqtt broker for embedded devices, developed in C++, FreeRTOS to use advanced multitasking capabilities, and arduino core. Tested in an Esp32 and esp8266.
https://github.com/alexCajas/EmbeddedMqttBroker
MIT License
71 stars 14 forks source link

Remove Serial Print and replace it by esp log commands #9

Closed SteeveGL closed 1 year ago

SteeveGL commented 1 year ago

Description

That library use Serial Print commands. I think it's a bad practice because the user cannot control it.

Solution

Espressif already include a logging library for esp2886 and esp32: Espressif - Logging library.

To set the logging level, simply use the build flag DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_{level}

Example for platformio

[env:esp32]
platform = espressif32
framework = arduino
board = esp32dev
lib_deps = 
    alexcajas/WrapperFreeRTOS @ ^1.0.1
        alexcajas/EmbeddedMqttBroker @ 1.0.4-qos0
build_flags = -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE