Skip to content

Add basic logcat viewer #36

Description

@SamratB8

Summary

Create a basic logcat viewer in WinDroid Studio for streaming Android system and application logs from the selected device or emulator.

The first version should provide start, stop, clear, and simple text-filter controls while preventing unlimited memory growth.

This is an initial developer-tool implementation and does not need advanced log parsing or query features.

Background

Android logcat is an important tool for:

  • Application debugging
  • Runtime diagnostics
  • Device troubleshooting
  • ADB verification
  • Future WinDroid runtime research

Because logcat is a continuous stream, it must be handled differently from short ADB commands.

Dependencies

This issue depends on:

The existing process runner may need a carefully scoped streaming extension.

ADB Command

The basic command is:

adb -s <device-serial> logcat

The command must explicitly target the selected device.

Streaming Requirements

The implementation should:

  • Start logcat asynchronously
  • Read output incrementally
  • Avoid waiting for the process to exit before displaying output
  • Support cancellation
  • Stop the process cleanly
  • Handle device disconnection
  • Avoid blocking the WinUI thread
  • Avoid leaving orphaned ADB processes
  • Stop streaming when the relevant page or application closes

Memory-Safety Requirements

Logcat can produce an unlimited amount of output.

The viewer must limit retained logs using a strategy such as:

  • Maximum number of retained lines
  • Circular buffer
  • Removal of oldest entries after reaching a cap

The initial line cap may be fixed and documented.

The UI must not keep an unlimited string containing the complete session output.

UI Requirements

Create a developer-tools page or panel with:

  • Selected-device indicator
  • Start button
  • Stop button
  • Clear button
  • Text-filter field
  • Scrollable log view
  • Streaming status
  • Error state
  • Line-count or retained-line indicator where practical

Filtering Requirements

The initial filter should:

  • Match text locally
  • Be case-insensitive
  • Avoid restarting logcat
  • Support clearing the filter
  • Avoid discarding the underlying capped log buffer

Advanced Android log priorities and tags can be added later.

Lifecycle Requirements

When streaming starts:

  • Start should become disabled
  • Stop should become enabled
  • The selected device should be captured for that stream

When streaming stops:

  • The process should terminate
  • Start should become available again
  • Existing captured logs may remain visible

When the device selection changes:

  • Stop any active stream first, or
  • Require the user to stop before switching

The viewer must not silently continue streaming from one device while showing another as selected.

Tasks

  • Add streaming-process support where required
  • Add logcat service
  • Explicitly target the selected device
  • Add cancellation and process termination
  • Create a capped in-memory log buffer
  • Create the logcat viewer UI
  • Add Start, Stop, and Clear controls
  • Add local text filtering
  • Add device-disconnection handling
  • Stop streaming during application shutdown
  • Add useful status and error messages
  • Add tests for buffer behavior
  • Add tests for filtering logic
  • Document any fixed line cap

Security and Privacy Requirements

Logcat may contain sensitive information.

The first version should:

  • Avoid automatically uploading logs
  • Avoid writing logs permanently to disk
  • Avoid including log contents in telemetry
  • Clearly treat exported logs as a future separate feature
  • Avoid displaying secrets elsewhere in the application

Out of Scope

This issue does not need to:

  • Add advanced tag filtering
  • Add log-priority dropdowns
  • Parse every logcat format
  • Colour-code priorities
  • Export logs
  • Search with regular expressions
  • Add bookmarks
  • Add timeline visualization
  • Add multiple simultaneous device streams
  • Persist logs between sessions
  • Upload diagnostic reports

Acceptance Criteria

  • The user can start logcat for the selected device.
  • Log lines appear incrementally.
  • The UI remains responsive during streaming.
  • The user can stop the stream.
  • Stopping does not leave an orphaned process.
  • Closing the application stops the stream.
  • Device disconnection is handled visibly.
  • Retained logs have a defined maximum size.
  • Old entries are removed safely after the cap is reached.
  • The user can clear visible logs.
  • Local text filtering works.
  • No logs are uploaded or permanently stored automatically.
  • Relevant buffer and filtering tests pass.
  • The full solution builds successfully in Debug and Release configurations.
  • No new compiler warnings are introduced.

Metadata

Metadata

Assignees

No one assigned

    Labels

    adbWork involving Android Debug Bridge integration, device communication, commands, and diagnostics.developer-toolsLogcat, shell, screenshots, file transfer, diagnostics, and debugging tools.enhancementNew feature or requesthelp wantedExtra attention is neededphase-3Work planned for the third dev phase, on dev tools, diagnostics, logcat, shell access & file ops.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions