LogcatReceiver

public class LogcatReceiver
extends Object implements ILogcatReceiver

java.lang.Object
   ↳ com.android.tradefed.device.LogcatReceiver


Class that collects logcat in background. Continues to capture logcat even if device goes offline then online.

Summary

Public constructors

LogcatReceiver(ITestDevice device, long maxFileSize, int logStartDelay)

Creates an instance with default logcat 'threadtime' format

LogcatReceiver(ITestDevice device, String logcatCmd, long maxFileSize, int logStartDelay)

Creates an instance with any specified logcat command

Public methods

void clear()
static String getDefaultLogcatCmd(ITestDevice device)

Get the default logcat command, only append uid format if api level > 24.

InputStreamSource getLogcatData(int maxBytes, int offset)

Returns the current logcat buffer given an offset.

InputStreamSource getLogcatData(int maxBytes)
InputStreamSource getLogcatData()
void start()
void stop()

Public constructors

LogcatReceiver

public LogcatReceiver (ITestDevice device, 
                long maxFileSize, 
                int logStartDelay)

Creates an instance with default logcat 'threadtime' format

Parameters
device ITestDevice: the device to start logcat on

maxFileSize long: maximum file size, earlier lines will be discarded once size is reached

logStartDelay int: the delay to wait after the device becomes online

LogcatReceiver

public LogcatReceiver (ITestDevice device, 
                String logcatCmd, 
                long maxFileSize, 
                int logStartDelay)

Creates an instance with any specified logcat command

Parameters
device ITestDevice: the device to start logcat on

logcatCmd String: the logcat command to run (including 'logcat' part), see details on available options in logcat help message

maxFileSize long: maximum file size, earlier lines will be discarded once size is reached

logStartDelay int: the delay to wait after the device becomes online

Public methods

clear

public void clear ()

getDefaultLogcatCmd

public static String getDefaultLogcatCmd (ITestDevice device)

Get the default logcat command, only append uid format if api level > 24.

Parameters
device ITestDevice

Returns
String

getLogcatData

public InputStreamSource getLogcatData (int maxBytes, 
                int offset)

Returns the current logcat buffer given an offset.

Parameters
maxBytes int: The max size of the returned buffer

offset int: The offset of the full buffer.

Returns
InputStreamSource The logcat buffer starting at the offset.

getLogcatData

public InputStreamSource getLogcatData (int maxBytes)

Parameters
maxBytes int

Returns
InputStreamSource

getLogcatData

public InputStreamSource getLogcatData ()

Returns
InputStreamSource

start

public void start ()

stop

public void stop ()