Google is committed to advancing racial equity for Black communities. See how.

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, String logcatCmd, long maxFileSize, int logStartDelay)

Creates an instance with any specified logcat command

LogcatReceiver(ITestDevice device, long maxFileSize, int logStartDelay)

Creates an instance with default logcat 'threadtime' format

Public methods

void clear()
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, 
                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

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

Public methods

clear

public void clear ()

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 ()