Skip to content

How to redirect all console output #7407

@zekageri

Description

@zekageri

Board

esp-wrover-kit

Device Description

ESP32_Wrover_E --> 8mb PSram, 16mb flash

Hardware Configuration

  • SPI
  • Eth_Lan8720
  • I2C

Version

latest master (checkout manually)

IDE Name

Platform IO

Operating System

Windows 10

Flash frequency

80Mhz

PSRAM enabled

yes

Upload speed

115200

Description

int _log_vprintf(const char *fmt, va_list args) does not redirect everything.

Sketch

File routerFile;
char log_print_buffer[512];
#define REROUTE_PATH "/testlog.txt"
int _log_vprintf(const char *fmt, va_list args) {
    int ret = vsnprintf(log_print_buffer, sizeof(log_print_buffer), fmt, args);
    if (ret >= 0){
        routerFile = LittleFS.open(REROUTE_PATH, FILE_APPEND);
        routerFile.write((uint8_t *)log_print_buffer, (size_t)ret);
        routerFile.close();
    }
    return vprintf(fmt, args);
}

void setReroute(){
    esp_log_set_vprintf(_log_vprintf);
    esp_log_level_set("*", ESP_LOG_VERBOSE);
}

void setup(){
    Serial.begin(115200);
    setReroute();
}

void loop(){
}

Debug Message

Everything goes to the serial except some messages like these ones:


E (1746) gpio: gpio_set_level(226): GPIO output gpio_num error
E (1779) gpio: gpio_set_level(226): GPIO output gpio_num error

Other Steps to Reproduce

No

I have checked existing issues, online documentation and the Troubleshooting Guide

  • I confirm I have checked existing issues, online documentation and Troubleshooting guide.

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