docs/library/esp: Correct the description of esp.osdebug().

The behaviour described in the docs was not correct for either port.

This work was funded through GitHub Sponsors.

Signed-off-by: Angus Gratton <angus@redyak.com.au>
This commit is contained in:
Angus Gratton
2023-11-07 14:11:20 +11:00
committed by Damien George
parent 917b56137f
commit a800ed5ae3
2 changed files with 38 additions and 6 deletions

View File

@@ -37,12 +37,12 @@
#include "py/mphal.h"
STATIC mp_obj_t esp_osdebug(size_t n_args, const mp_obj_t *args) {
esp_log_level_t level = LOG_LOCAL_LEVEL;
esp_log_level_t level = LOG_LOCAL_LEVEL; // Maximum available level
if (n_args == 2) {
level = mp_obj_get_int(args[1]);
}
if (args[0] == mp_const_none) {
// Disable logging
// Set logging back to boot default of ESP_LOG_ERROR
esp_log_level_set("*", ESP_LOG_ERROR);
} else {
// Enable logging at the given level