Kernel Logs Viewer Component
Relevant source files
The following files were used as context for generating this wiki page:
The Kernel Logs Viewer Component renders a real-time terminal interface that displays build outputs during the kernel compilation process. It visualizes compilation progress, patch application status, and system messages within the KernelForge dashboard. Sources: src/components/dashboard/KernelLogs.tsx:1-53, src/app/page.tsx:327-329
This component integrates with the AI Troubleshooting Assistant to facilitate log analysis when build errors occur. Sources: src/components/dashboard/AITroubleshooter.tsx:13-15, README.md:16-19
Component Architecture and Data Flow
The KernelLogs component functions as a controlled display unit that receives an array of log entries via props. It uses a ref to manage automatic scrolling, ensuring the most recent log entries remain visible to the user as the build progresses. Sources: src/components/dashboard/KernelLogs.tsx:14-22
Logic Flow and Auto-Scrolling
The component triggers a side effect whenever the logs prop updates. This effect calculates the current scroll height and adjusts the scroll position to the bottom of the container. Sources: src/components/dashboard/KernelLogs.tsx:24-28
The auto-scroll mechanism maintains user focus on the latest compilation activity. Sources: src/components/dashboard/KernelLogs.tsx:24-28
Data Structures
The component relies on a specific interface for log entries to determine formatting and icons. Sources: src/components/dashboard/KernelLogs.tsx:6-12
| Property | Type | Description |
|---|---|---|
id | string | Unique identifier for the log entry. |
timestamp | string | The time the log was generated. |
level | info | error | warning | success | Determines the text color and prefix icon. |
message | string | The actual log content or command output. |
Sources: src/components/dashboard/KernelLogs.tsx:6-11
Visual Representation and UI Logic
The component renders a terminal-style window with a header containing decorative window controls and a title. The body uses a ScrollArea to contain the log messages. Sources: src/components/dashboard/KernelLogs.tsx:31-40
Log Level Styling
The component maps each log level to a specific color and icon to improve readability of the build process status. Sources: src/components/dashboard/KernelLogs.tsx:55-68
Empty State Handling
If the logs array is empty, the component displays an italicized, pulsing message indicating it is waiting for the compilation to begin. Sources: src/components/dashboard/KernelLogs.tsx:47-51
Integration with Dashboard
The KernelcrafterDashboard manages the state of the logs and passes them to the KernelLogs component. The dashboard provides an addLog function to append new messages to the state. Sources: src/app/page.tsx:64-71
AI Analysis Integration
Build logs are converted into a single string via the logsText variable and passed to the AITroubleshooter. This component utilizes the aiBuildTroubleshootingAssistant to identify errors and suggest solutions. Sources: src/app/page.tsx:165, src/components/dashboard/AITroubleshooter.tsx:20-25, src/ai/flows/ai-build-troubleshooting-assistant.ts:31-35
The analysis identifies critical issues such as:
- KMI/GKI compatibility problems.
- Failed patch hooks for KernelSU or SUSFS.
- Missing build dependencies.
Sources: README.md:16-19
Summary
The Kernel Logs Viewer Component provides the primary feedback loop for users during kernel development. By receiving structured log data from the main dashboard and applying conditional styling based on log levels, it transforms raw build output into a readable terminal interface. Its integration with the AI Troubleshooter allows for rapid debugging of compilation failures. Sources: src/components/dashboard/KernelLogs.tsx:31-75, src/app/page.tsx:73-86, README.md:16-19