feat: add Laravel stack trace visualization tab #470
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📝 Description
This PR enhances the log viewer experience for Laravel developers by adding a beautiful Stack Trace tab that automatically appears when Laravel exception logs contain stack trace information.
🚀 What's Changed
Added Stack Trace Tab: A new tab appears automatically for Laravel logs containing [stacktrace] sections
Exception Header Display: Shows exception type, message, and location with proper styling
Stack Trace Frames: Displays numbered frames with file paths, line numbers, and method calls
Performance Optimized: Stack traces are only parsed when the tab is clicked (lazy loading)
Maintains Existing Behavior: Raw tab remains the default, all existing functionality preserved
🎨 Visual Improvements
The new Stack Trace tab provides:
Exception Header: Red-highlighted exception type with clear error message
File Paths: Blue-colored file paths with orange line numbers
Frame Numbers: Gray-styled frame indicators (#0, #1, etc.)
Responsive Design: Works seamlessly on both desktop and mobile
Dark Mode Support: Proper styling for both light and dark themes
💻 Technical Details
Files Modified:
BaseLogTable.vue - Added stack trace detection and parsing logic
Key Functions Added:
hasLaravelStackTrace(log) - Lightweight detection of stack traces
getStackTraceData(log) - Parses exception headers and stack frames
Enhanced getTabsForLog(log) - Includes Stack Trace tab when applicable
Parser Features:
Detects Laravel exception format with [stacktrace] sections
Parses exception headers: [object] (ExceptionType(code: 0): Message at /path/file.php:123)
Extracts stack frames: #0 /path/file.php(123): Class::method()
Handles edge cases for malformed or incomplete stack traces
📱 Usage Example
The Stack Trace tab will automatically appear and display:
Exception Type: Error
Message: Call to undefined method App\Models\User::invalidMethod()
Location: in /app/Http/Controllers/UserController.php:25
Stack Frames: Properly formatted with file paths and line numbers
🎯 Benefits
Better Debugging Experience: Developers can quickly identify error locations
Improved Readability: Clean, formatted display vs raw text
Time Saving: No need to manually parse stack traces
Laravel-Specific: Tailored for Laravel's exception format
Non-Breaking: Existing functionality remains unchanged