fix: print each log line whole

The Arduino core's log_printf() has its UART lock commented out and
writes with ets_printf(), so lines logged at the same time from
async_tcp and loop() came out interleaved character by character. It
also formats short lines into one static buffer shared by every task.

Wrap log_printf at link time and hold a mutex around the core's
log_printfv(). It never blocks before the scheduler runs, in an ISR or
in a critical section, and waits at most 50ms before printing anyway.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
cjkas 2026-10-11 20:50:41 +02:00
parent dd47c04905
commit 6b19d24eb4
2 changed files with 38 additions and 0 deletions

View file

@ -37,6 +37,8 @@ build_flags =
-DCONFIG_ESP_COREDUMP_CHECKSUM_CRC32=1
-DCONFIG_ESP_TASK_WDT_PANIC=1
-DCONFIG_ESP_COREDUMP_DECODE_INFO=1
; Route log_printf through src/LogLock.cpp so lines from both cores don't interleave.
-Wl,--wrap=log_printf
monitor_speed = 115200
monitor_filters =
time