This module provides real-time Android device log reading capabilities via the adb logcat command.
from pywayne.adb.logcat_reader import AdbLogcatReader
# Create reader (default C++ backend)
reader = AdbLogcatReader()
# Start log capture and read
reader.start()
for line in reader.read():
print(line)
reader = AdbLogcatReader(backend='python')
reader.start()
for line in reader.read():
print(line)
# Stop and cleanup
reader.stop()
# C++ backend (default, faster)
reader = AdbLogcatReader()
# Python backend (alternative, may be more compatible)
reader = AdbLogcatReader(backend='python')
The read() method yields log lines incrementally as a generator, suitable for processing large logs or real-time monitoring.
# Process logs as they arrive
for line in reader.read():
# Filter, parse, store...
| Property | Description | |
|---|---|---|
| --------- | ------------- | |
backend | 'cpp' or 'python' | Active backend for adb logcat |
running | Whether logcat process is running |
| Method | Description |
|---|---|
| --------- | ------------- |
start() | Start adb logcat process |
read() | Generator yielding log lines |
stop() | Stop logcat process |
get_backend() | Get active backend type |
stop() terminates adb logcat; use Ctrl+C to send interrupt signal共 1 个版本