Feature/logcat#1
Conversation
… capabilities - Updated LogsModule to support real-time log streaming with start/stop controls - Implemented filtering by log level, tag, and search query - Improved UI layout for log entries with additional PID display - Added functionality to generate test logs in the sample app for demonstration - Updated instructions in the main activity to include new log generation feature
- Introduced a main menu view for module selection and improved navigation - Updated DebugOverlay to manage module display and interactions more effectively - Added support for dynamic module updates with a dedicated adapter - Refined layout parameters in module_logcat.xml for better usability and aesthetics
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new Logcat Viewer module to the debug drawer, providing real-time logcat streaming with advanced filtering and search capabilities. The module replaces the basic logs functionality with a comprehensive logging interface that includes level filtering, tag filtering, search, and live streaming controls.
- Enhanced logcat viewing with real-time streaming, pause/resume, and filtering by log level, tag, and text search
- Updated UI layouts with a new grid-based main menu and dedicated module view containers
- Added test log generation functionality to the sample app for demonstration purposes
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| sampleapp/src/main/res/layout/activity_main.xml | Added "Generate Test Logs" button and updated instructions |
| sampleapp/src/main/java/com/abualzait/debugdrawer/sampleapp/MainActivity.kt | Implemented test log generation functionality with various log levels and tags |
| debugdrawer/src/main/res/layout/module_logcat.xml | New comprehensive logcat viewer layout with controls for streaming, filtering, and search |
| debugdrawer/src/main/res/layout/item_log.xml | Redesigned log item layout with dark theme and monospace font |
| debugdrawer/src/main/res/layout/debug_module_view.xml | New layout for individual module views with navigation header |
| debugdrawer/src/main/res/layout/debug_module_item.xml | Grid item layout for module selection in main menu |
| debugdrawer/src/main/res/layout/debug_drawer_main_menu.xml | New main menu layout with grid-based module selection |
| debugdrawer/src/main/res/drawable/debug_module_item_background.xml | Background drawable for module grid items |
| debugdrawer/src/main/java/com/abualzait/debugdrawer/modules/LogsModule.kt | Complete rewrite with real-time streaming, filtering, and enhanced functionality |
| debugdrawer/src/main/java/com/abualzait/debugdrawer/adapter/DebugModuleAdapter.kt | New adapter for grid-based module selection |
| debugdrawer/src/main/java/com/abualzait/debugdrawer/DebugDrawer.kt | Updated to support new grid-based navigation and module view system |
| .github/workflows/ci.yml | Simplified CI workflow triggers |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| executor.execute { | ||
| try { | ||
| logcatProcess = Runtime.getRuntime().exec("logcat -v time") | ||
| val reader = BufferedReader(InputStreamReader(logcatProcess?.inputStream)) | ||
|
|
||
| reader.useLines { lines -> | ||
| lines.forEach { line -> | ||
| if (!isPaused) { | ||
| val logEntry = parseLogLine(line) | ||
| if (logEntry != null) { | ||
| mainHandler.post { | ||
| addLogEntry(logEntry) | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } catch (e: Exception) { | ||
| logger.e("LogsModule", "Failed to stream logs", e) | ||
| mainHandler.post { | ||
| isStreaming = false | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
The background thread execution could continue indefinitely if the logcat process doesn't terminate naturally. The isStreaming flag should be checked within the forEach loop to allow for clean interruption when streaming is stopped.
| } | ||
|
|
||
| override fun onDetach() { | ||
| stopLogcatStreaming() |
There was a problem hiding this comment.
The executor service should be properly shut down in the onDetach method to prevent resource leaks. Add executor.shutdown() after stopping logcat streaming.
| stopLogcatStreaming() | |
| stopLogcatStreaming() | |
| executor.shutdown() |
No description provided.