Skip to content

Commit

Permalink
Add logcat method to adb (#2397)
Browse files Browse the repository at this point in the history
Co-authored-by: piotruela <[email protected]>
  • Loading branch information
piotruela and piotruela authored Nov 7, 2024
1 parent 05287bb commit 19a325f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
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

0 comments on commit 19a325f

Please sign in to comment.