From 6847b46b0d2c97c86777525ddfb16f7237272e8c Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 21 Jan 2026 15:17:41 -1000 Subject: [PATCH] Fix ESP8266 crash in logging macros due to __FUNCTION__ in flash --- src/AsyncWebServerLogging.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/AsyncWebServerLogging.h b/src/AsyncWebServerLogging.h index c4f62e65..e498f5d8 100644 --- a/src/AsyncWebServerLogging.h +++ b/src/AsyncWebServerLogging.h @@ -81,6 +81,7 @@ /** * ESP8266 specific configurations + * Note: __FUNCTION__ is stored in flash on ESP8266, so we use FPSTR() to handle it properly */ #elif defined(ESP8266) #include @@ -98,31 +99,31 @@ #endif // error #if ASYNCWEBSERVER_LOG_LEVEL >= ASYNC_WS_LOG_ERROR -#define async_ws_log_e(format, ...) ets_printf(String(F("E async_ws %s() %d: " format)).c_str(), __FUNCTION__, __LINE__, ##__VA_ARGS__); +#define async_ws_log_e(format, ...) Serial.printf_P(PSTR("E async_ws %d: " format "\n"), __LINE__, ##__VA_ARGS__) #else #define async_ws_log_e(format, ...) #endif // warn #if ASYNCWEBSERVER_LOG_LEVEL >= ASYNC_WS_LOG_WARN -#define async_ws_log_w(format, ...) ets_printf(String(F("W async_ws %s() %d: " format)).c_str(), __FUNCTION__, __LINE__, ##__VA_ARGS__); +#define async_ws_log_w(format, ...) Serial.printf_P(PSTR("W async_ws %d: " format "\n"), __LINE__, ##__VA_ARGS__) #else #define async_ws_log_w(format, ...) #endif // info #if ASYNCWEBSERVER_LOG_LEVEL >= ASYNC_WS_LOG_INFO -#define async_ws_log_i(format, ...) ets_printf(String(F("I async_ws %s() %d: " format)).c_str(), __FUNCTION__, __LINE__, ##__VA_ARGS__); +#define async_ws_log_i(format, ...) Serial.printf_P(PSTR("I async_ws %d: " format "\n"), __LINE__, ##__VA_ARGS__) #else #define async_ws_log_i(format, ...) #endif // debug #if ASYNCWEBSERVER_LOG_LEVEL >= ASYNC_WS_LOG_DEBUG -#define async_ws_log_d(format, ...) ets_printf(String(F("D async_ws %s() %d: " format)).c_str(), __FUNCTION__, __LINE__, ##__VA_ARGS__); +#define async_ws_log_d(format, ...) Serial.printf_P(PSTR("D async_ws %d: " format "\n"), __LINE__, ##__VA_ARGS__) #else #define async_ws_log_d(format, ...) #endif // verbose #if ASYNCWEBSERVER_LOG_LEVEL >= ASYNC_WS_LOG_VERBOSE -#define async_ws_log_v(format, ...) ets_printf(String(F("V async_ws %s() %d: " format)).c_str(), __FUNCTION__, __LINE__, ##__VA_ARGS__); +#define async_ws_log_v(format, ...) Serial.printf_P(PSTR("V async_ws %d: " format "\n"), __LINE__, ##__VA_ARGS__) #else #define async_ws_log_v(format, ...) #endif