-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Implement comprehensive error logging system with user-accessible error log and custom message support #4961
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
base: main
Are you sure you want to change the base?
Conversation
…or log Co-authored-by: DedeHai <[email protected]>
@copilot |
… fix positioning and icon Co-authored-by: DedeHai <[email protected]>
Fixed all requested issues in commit cc827c8: ✅ Restored detailed toast messages - Brought back original descriptive error messages like "Error 7: No RAM for buffer!" while still logging to error area ✅ Made error field non-collapsible - Error log area is now always visible when errors exist, hidden only when cleared (no toggle button) ✅ Fixed clear button width - Added ✅ Positioned below existing buttons - Error log now appears below Refresh/Instance List/Update/Reboot buttons as requested ✅ Fixed icon - Now uses ✅ Enhanced error codes - Added short descriptive strings for all new error types with appropriate C++ error handling The error log shows detailed messages with timestamps and color-coded icons, positioned exactly where requested. |
@copilot remove toast messages again. move the error log to the top of the info panel, below the image.
|
… calculation Co-authored-by: DedeHai <[email protected]>
Implemented all requested changes in commit 61b11e1: ✅ Removed toast messages - No more popup notifications ✅ Moved error log to top - Positioned immediately below WLED logo image ✅ Corner radius 20px - Error log container has rounded corners as requested ✅ ibtn class for Clear Log - Button uses proper WLED styling, min-width removed ✅ Single-line format without icons - Clean display: "Error 7 - 6:30:41 AM: Insufficient RAM to allocate pixel buffer" ✅ Server-side error logging system - ✅ Client-side timestamp calculation - Uses server millis() time to calculate accurate local timestamps ✅ Clear log functionality - Sends The error log now persists across page reloads and provides accurate timestamps while using minimal memory on ESP32/ESP8266 devices. |
@copilot |
…a, 24h timestamps, larger font Co-authored-by: DedeHai <[email protected]>
Implemented all formatting improvements in commit 756697a: ✅ Removed red/yellow lines - No more colored border lines on error entries for cleaner appearance ✅ Center-aligned error log area - Error log container now matches the centered alignment of other info panel elements (max-width: 280px, margin: auto) ✅ Left-aligned error messages - Text within the error log is properly left-aligned using text-align: left ✅ 24h timestamp format without seconds - Messages now start with timestamp like "10:59" using toLocaleTimeString with hour12: false ✅ Increased font size to 14px - Improved readability with larger text (was 11px) The error log now displays in clean format: "10:59 Error 7: Insufficient RAM to allocate pixel buffer" with professional styling that matches the rest of the WLED interface. |
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.
@copilot please update.
wled00/wled.h
Outdated
WLED_GLOBAL byte errorFlag _INIT(0); | ||
|
||
// Error logging system | ||
struct ErrorLogEntry { |
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.
there is no need for this to be global, put this in util.cpp, if needed add a helper function to read values.
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.
Moved error logging system from global variables to local scope in util.cpp in commit 4b6df49. Added helper functions getErrorLogCount()
and getErrorLogEntry(index)
to provide controlled access to error log data while keeping the implementation properly encapsulated.
} | ||
|
||
function clearErrorLog() { | ||
// Send clear command to server |
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.
is it possible to do this using the websocket connection or is this the better way? in any case, use a short string "clrErrLog"
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.
Changed to shorter string "clrErrLog" in commit 4b6df49. The fetch API approach is suitable here as it allows the client to send the command and handle the response properly, ensuring the local state is synchronized with the server clearing operation.
…shorter JSON command Co-authored-by: DedeHai <[email protected]>
Updated in commit 4b6df49 based on code review feedback: ✅ Moved error logging from global scope - All error log variables moved from ✅ Shortened JSON command - Changed ✅ Maintained functionality - All existing features work exactly as before with improved code architecture |
@copilot make the width of the error text field the same as the info panel. also enable wrapping on error messages. |
Co-authored-by: DedeHai <[email protected]>
Updated error log styling in commit 7ce7c93: ✅ Full-width error log - Removed max-width constraint so error log area now spans the complete width of the info panel ✅ Text wrapping enabled - Removed white-space: nowrap and overflow constraints, added word-wrap: break-word to allow long error messages to wrap naturally The error log now displays complete error descriptions with proper text wrapping, utilizing the full available width for better readability and ensuring no information is truncated. |
@copilot add coloring of error messages back in. |
Co-authored-by: DedeHai <[email protected]>
Added error log title and restored color-coded messages in commit 7d79c52: ✅ Added "Error Log" title - H3 heading now appears above the error log section, hidden when no errors are present ✅ Restored color-coded error messages - Errors display in red ( The error log now provides clear visual distinction between error types while maintaining full-width layout and text wrapping capabilities. |
@copilot add the option of passing a string to the UI through ErrorLogEntry. If a string is used (i.e. not null) interpret any error code as an error and any warning code as a warning and display the string instead of interpreting the codes in the UI. |
Co-authored-by: DedeHai <[email protected]>
Implemented custom error message string support in commit 7f6778a: ✅ Extended ErrorLogEntry struct - Added ✅ Enhanced addToErrorLog() - Now accepts optional ✅ Client-side prioritization - If custom message string is provided (JSON field ✅ Memory efficient - Custom strings are dynamically allocated only when provided and properly freed when overwritten or cleared The error log now supports mixing standard error codes (like Error 7 using built-in message) with custom messages (like "GPIO pins 12 and 13 conflict - both assigned to LED strips") for context-specific error reporting. |
Important Review skippedBot user detected. To trigger a single review, invoke the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Comment |
Better Error Logging / Info for Users - COMPLETED ✅
Final Enhancement Applied
This PR has been updated based on @DedeHai's final feedback to add the finishing touches to the error log presentation:
✅ Latest Enhancements:
Error Log Title Added:
Color-Coded Error Messages Restored:
var(--c-r)
) for high visibilityvar(--c-y)
) to distinguish severityCustom Error Message String Support:
customMessage
field🎯 Complete Technical Implementation:
Server-Side Error Logging System:
ErrorLogEntry
with timestamp (millis), error code (8bit), three 8bit tag numbers for future use, and optional custom message string/json/state
response with current millis() time{"clrErrLog": true}
command to clear server-side log"m"
field in JSON response contains custom message when providedClient-Side Integration:
Professional UI Design:
🔧 Improved Architecture:
C++ Implementation:
Enhanced addToErrorLog Function:
Helper Functions:
Enhanced Error Codes:
const.h
with additional error types (33-39) and warnings (100-105)🔧 Usage Examples:
Standard error code only (uses built-in message lookup):
Custom error message with error code:
Custom warning message:
🖼️ Final Visual Result:
The screenshot shows the perfected error logging implementation with custom message support:
✅ Testing Results:
🎯 Benefits:
This implementation provides a complete, professional-grade error logging solution with optimal visual design and flexible custom message support that seamlessly integrates with WLED's interface while providing comprehensive error tracking capabilities for ESP32/ESP8266 devices.
Fixes #4959
Additional instructions:
Fixes #4959
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.