ClusterLogSaver

public class ClusterLogSaver
extends Object implements ILogSaver

java.lang.Object
   ↳ com.android.tradefed.cluster.ClusterLogSaver


A ILogSaver class to upload test outputs to TFC.

Summary

Fields

public static final String FILE_NAMES_FILE_NAME

A name of a text file containing all test output file names.

public static final String TOOL_LOG_PATH

A name of a subdirectory containing all files generated by host process.

Public constructors

ClusterLogSaver()

Public methods

LogFile getLogReportDir()

Get the LogFile containing the path and/or URL of the directory where logs are saved.

void invocationEnded(long elapsedTime)

Reports that the invocation has terminated, whether successfully or due to some error condition.

void invocationStarted(IInvocationContext context)

Reports the start of the test invocation.

LogFile saveLogData(String dataName, LogDataType dataType, InputStream dataStream)

Save the log data.

Fields

FILE_NAMES_FILE_NAME

public static final String FILE_NAMES_FILE_NAME

A name of a text file containing all test output file names.

TOOL_LOG_PATH

public static final String TOOL_LOG_PATH

A name of a subdirectory containing all files generated by host process.

Public constructors

ClusterLogSaver

public ClusterLogSaver ()

Public methods

getLogReportDir

public LogFile getLogReportDir ()

Get the LogFile containing the path and/or URL of the directory where logs are saved.

Returns
LogFile The LogFile.

invocationEnded

public void invocationEnded (long elapsedTime)

Reports that the invocation has terminated, whether successfully or due to some error condition.

Will be automatically called by the TradeFederation framework after ITestInvocationListener.invocationEnded(long) is called.

Parameters
elapsedTime long: the elapsed time of the invocation in ms

invocationStarted

public void invocationStarted (IInvocationContext context)

Reports the start of the test invocation.

Will be automatically called by the TradeFederation framework before ITestInvocationListener.invocationStarted(IInvocationContext) is called.

Parameters
context IInvocationContext: information about the invocation.

saveLogData

public LogFile saveLogData (String dataName, 
                LogDataType dataType, 
                InputStream dataStream)

Save the log data.

Will be automatically called by the TradeFederation framework whenever ITestLogger.testLog(String, com.android.tradefed.result.LogDataType, com.android.tradefed.result.InputStreamSource) is called. It may also be used as a helper method to save additional log data.

Depending on the implementation and policy, the logs may be saved in a compressed form. Logs may also be stored in a location inaccessible to Tradefed.

Parameters
dataName String: a String descriptive name of the data. e.g. "device_logcat"

dataType LogDataType: the LogDataType of the file.

dataStream InputStream: the ERROR(/InputStream) of the data.

Returns
LogFile the LogFile containing the path and URL of the saved file.