Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add logcat method to adb #2397

Merged
merged 1 commit into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/adb/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.5.0

- Add `logcat` method to `Adb` (#2387)

## 0.4.1

- Bump minimum Dart SDK to version 3.5.0 (#2371)
Expand Down
26 changes: 26 additions & 0 deletions packages/adb/lib/src/adb.dart
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,32 @@ class Adb {
return process;
}

/// Returns process that listen for adb logs.
Future<io.Process> logcat({
String? device,
Map<String, String> arguments = const {},
String? filter,
}) async {
await _adbInternals.ensureServerRunning();

final process = await io.Process.start(
'adb',
[
if (device != null) ...['-s', device],
'shell',
'logcat',
for (final arg in arguments.entries) ...[
arg.key,
arg.value,
],
if (filter != null) filter,
],
runInShell: true,
);

return process;
}

/// Returns the list of currently attached devices.
///
/// See also:
Expand Down
2 changes: 1 addition & 1 deletion packages/adb/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: adb
description: Simple Dart wrapper around Android Debug Bridge.
version: 0.4.1
version: 0.5.0
repository: https://github.com/leancodepl/patrol/tree/master/packages/adb
issue_tracker: https://github.com/leancodepl/patrol/issues?q=is%3Aopen+is%3Aissue+label%3A%22package%3A+adb%22

Expand Down
Loading