MCPcopy Index your code
hub / github.com/callstack/agent-device / captureAndroidLogcatWithAdb

Function captureAndroidLogcatWithAdb

src/platforms/android/logcat.ts:17–38  ·  view source on GitHub ↗
(
  adb: AndroidAdbExecutor,
  options: AndroidLogcatCaptureOptions = {},
)

Source from the content-addressed store, hash-verified

15};
16
17export async function captureAndroidLogcatWithAdb(
18 adb: AndroidAdbExecutor,
19 options: AndroidLogcatCaptureOptions = {},
20): Promise<string> {
21 const args = ['logcat', '-d', '-v', 'time'];
22 if (options.lines !== undefined) {
23 args.push('-t', String(Math.max(1, Math.floor(options.lines))));
24 }
25 const result = await adb(args, {
26 allowFailure: true,
27 timeoutMs: options.timeoutMs,
28 signal: options.signal,
29 });
30 if (result.exitCode !== 0) {
31 throw new AppError('COMMAND_FAILED', 'Failed to capture Android logcat', {
32 stdout: result.stdout,
33 stderr: result.stderr,
34 exitCode: result.exitCode,
35 });
36 }
37 return result.stdout;
38}
39
40export function streamAndroidLogcatWithAdb(
41 provider: Pick<AndroidAdbProvider, 'spawn'>,

Callers 1

Calls 2

pushMethod · 0.80
adbFunction · 0.50

Tested by

no test coverage detected