Skip to content

Commit

Permalink
Clean up docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Maaaartin committed Oct 20, 2024
1 parent a1d0edf commit 8ea3af6
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 14 deletions.
19 changes: 14 additions & 5 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -670,11 +670,6 @@ export class Client {
* console.log(entry);
* });
*/
public async openLogcat(serial: string): Promise<LogcatReader>;
public async openLogcat(
serial: string,
options: LogcatOptions
): Promise<LogcatReader>;
public async openLogcat(
serial: string,
options?: LogcatOptions
Expand All @@ -686,6 +681,20 @@ export class Client {
).execute();
}

/**
* Opens logcat, uses TextParser instead of BinaryParser
* Allows filtering based on Priority @see `PriorityV2` @see `LogcatOptionsV2`
* Better performance that LogcatReader as filtering is done by ADB cli itself.
* @example
* import { Client, PriorityV2 } from 'adb-ts';
* const adb = new Client();
* const logcat = await adb.openLogcatV2('serial', {
* filterSpecs: { filters: [{ tag: 'ActivityManager', priority: PriorityV2 }] }
* });
* for await (const entry of logcat.logs()) {
* console.log(entry);
* }
*/
public async openLogcatV2(
serial: string,
options?: LogcatOptionsV2
Expand Down
11 changes: 8 additions & 3 deletions src/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ import {
PropertyValue,
KeyEventOptions,
InputDurationOptions,
NonEmptyArray
NonEmptyArray,
LogcatOptionsV2
} from './util';
import { Client } from './client';
import { Connection } from './connection';
import { FileStat } from './filestats';
import { KeyCode } from './util/keycode';
import { LogcatReader } from './logcat/reader';
import { LogcatReader, LogcatReaderV2 } from './logcat/reader';
import { Monkey } from './monkey/client';
import { PullTransfer } from './sync/pulltransfer';
import { PushTransfer } from './sync/pushtransfer';
Expand Down Expand Up @@ -128,7 +129,11 @@ export class Device implements IDevice {
}

public openLogcat(options?: LogcatOptions): Promise<LogcatReader> {
return this.client.openLogcat(this.id, options as LogcatOptions);
return this.client.openLogcat(this.id, options);
}

public openLogcatV2(options?: LogcatOptionsV2): Promise<LogcatReaderV2> {
return this.client.openLogcatV2(this.id, options);
}

public clear(pkg: string): Promise<void> {
Expand Down
2 changes: 1 addition & 1 deletion src/linetransform.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Transform, TransformOptions } from 'stream';

export interface LineTransformOptions extends TransformOptions {
interface LineTransformOptions extends TransformOptions {
autoDetect: boolean;
}
/**
Expand Down
5 changes: 0 additions & 5 deletions src/logcat/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import { Writable } from 'stream';
import { LogcatReaderOptions } from '../util';
import { LogcatReader } from './reader';

export {
default as LineTransform,
LineTransformOptions
} from '../linetransform';
export * from './reader';
export * from './parser';
export * from './priority';
Expand Down
3 changes: 3 additions & 0 deletions src/logcat/reader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ export class LogcatReader extends StreamHandler {
}
}

/**
* @ignore
*/
export interface TextParserConstruct {
new (): TextParserBase;
}
Expand Down

0 comments on commit 8ea3af6

Please sign in to comment.