Commit 9313e9f
fix(log): strip ANSI escape codes from buffered web log lines
When CONFIG_LOG_COLORS is enabled (the ESP-IDF default), ESP_LOG wraps each
line in ANSI color sequences. LogBuffer captured these raw, and the ESC byte
(0x1b) is a control character ArduinoJson does not escape -- so /api/log
returned invalid JSON and the web log viewer failed to parse every poll,
showing a permanent "Reconnecting...". The precompiled Arduino framework ships
with colors off, which is why this only surfaced on espidf builds.
Strip ANSI sequences in push_line(), which stores the buffered copy. The
console output is forwarded to the previous vprintf handler before push_line()
runs, so serial/USB log colors are unaffected.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent c571b66 commit 9313e9f
1 file changed
Lines changed: 43 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
72 | 105 | | |
73 | 106 | | |
74 | 107 | | |
| |||
77 | 110 | | |
78 | 111 | | |
79 | 112 | | |
80 | | - | |
81 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
82 | 122 | | |
83 | 123 | | |
84 | 124 | | |
85 | 125 | | |
86 | | - | |
| 126 | + | |
87 | 127 | | |
88 | 128 | | |
89 | 129 | | |
| |||
0 commit comments