-
Notifications
You must be signed in to change notification settings - Fork 88
Fix ESP8266 crash in logging macros due to __FUNCTION__ in flash #371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 <ets_sys.h> | ||
|
|
@@ -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__) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it useful to print the line number without the function name? We'll be searching on the error text either way.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I saw that but agree with if because it quickly helps determine if the prints are in sync or not with the code we are reading. That's usually the first thing I look when users are giving some logs or stack... I first make sure the code they run is really the code they thunk they run. |
||
| #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 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment doesn't reflect the code below anymore as
__FUNCTION__was removed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a commit in PR #373 to cleanup