Skip to content

Integrate logcat for launching Android emulators/devices#18

Merged
dungngminh merged 2 commits into
mainfrom
feature/integrate-logcat-dialog
Apr 4, 2026
Merged

Integrate logcat for launching Android emulators/devices#18
dungngminh merged 2 commits into
mainfrom
feature/integrate-logcat-dialog

Conversation

@dungngminh
Copy link
Copy Markdown
Owner

@dungngminh dungngminh commented Apr 4, 2026

Description

This PR will add logcat for launching Android devices/emulators

Screen.Recording.2026-04-05.at.00.50.13.mov

Type of Change

  • 🔥 New feature (non-breaking change which adds functionality)
  • ✨ Enhancement (non-breaking change which improves existing functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • 🧹 Code refactor
  • 📝 Documentation
  • 🗑️ Chore
  • 📦 Build configuration change
  • ✅ Test

Summary by CodeRabbit

  • New Features
    • Added logcat dialog for viewing real-time logs from running Android emulators and devices
    • Logcat view supports dynamic filtering with keyboard shortcuts (e.g., / to filter, ↑/↓ to navigate, a to toggle auto-scroll, c to clear logs, o to open detected file paths)
    • Press l on a running device to launch the logcat viewer

@dungngminh dungngminh added the feature Features ✨ label Apr 4, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 4, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

This change introduces a logcat dialog feature for viewing live Android device and emulator logs. It adds a new dialog component with log streaming, dynamic filtering, keyboard navigation, and helper utilities for log parsing. The feature is integrated into the device list with a keyboard shortcut (L key).

Changes

Cohort / File(s) Summary
Version Updates
CHANGELOG.md, pubspec.yaml
Added version 0.4.0 release notes and bumped project version from 0.3.2 to 0.4.0; updated nocterm dependency from ^0.5.1 to ^0.6.0.
Logcat Core Components
lib/plugins/logcat/logcat_dialog.dart, lib/plugins/logcat/logcat_filter_bar.dart, lib/plugins/logcat/logcat_helper.dart
Introduced new logcat dialog with adb process streaming, in-memory log buffering, and keyboard-driven navigation. Added UI component for filter input with help text. Implemented utilities for threadtime-style log parsing, level detection, crash identification, and filter matching.
Device List Integration
lib/components/device_list_component.dart
Extended constructor with optional onDeviceLogcatRequested callback; added keyboard handler for L key that invokes logcat action only when selected device is running.
App Integration
lib/simutil_app.dart
Wired logcat callback into Android devices and emulators panels; added logcat action indicator to idle status messages; implemented handler to display logcat dialog with device and adb path context.

Sequence Diagram

sequenceDiagram
    actor User
    participant DeviceList as DeviceList Component
    participant App as SimUtil App
    participant LogcatDialog as Logcat Dialog
    participant ADB as ADB Process
    participant UI as Logcat UI

    User->>DeviceList: Press L key on running device
    DeviceList->>App: onDeviceLogcatRequested(device)
    App->>LogcatDialog: showLogcatDialog(context, device, adbPath)
    LogcatDialog->>ADB: spawn adb logcat -s <device_id>
    ADB-->>LogcatDialog: stdout stream (log lines)
    LogcatDialog->>LogcatDialog: Parse each line (level, format)
    LogcatDialog->>LogcatDialog: Buffer in sliding window
    LogcatDialog->>UI: Render filtered logs
    UI-->>User: Display log output
    User->>UI: Press / to filter
    UI->>UI: Show LogcatFilterBar
    User->>UI: Type filter pattern
    UI->>LogcatDialog: Apply filter
    LogcatDialog->>LogcatDialog: lineMatchesFilter(line, filter)
    LogcatDialog->>UI: Update filtered view
    User->>UI: Press Escape or click close
    LogcatDialog->>ADB: Kill process
    LogcatDialog->>LogcatDialog: Dispose resources
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Poem

🐰 A logcat dialog hops into view,
With adb streams and filtering too!
L-key shortcut, logs flow in streams,
Keyboard dance through a device's dreams—
Crashes found, filters applied with care,
Debugging speed through the Android air!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding logcat functionality to the application for Android devices and emulators, matching the substantial file additions across logcat-related modules.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/integrate-logcat-dialog

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dungngminh dungngminh merged commit 71bb1e6 into main Apr 4, 2026
5 of 6 checks passed
@dungngminh dungngminh deleted the feature/integrate-logcat-dialog branch April 4, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Features ✨

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant