ILogSaver

public interface ILogSaver

com.android.tradefed.result.ILogSaver
Known Indirect Subclasses
FileSystemLogSaver Save logs to a file system. 


Classes which implement this interface provide methods for storing logs to a central location.

A ILogSaver is declared in the configuration and is responsible for storing logs to a central location. It also exposes methods so ILogSaverListeners may save additional files to the same location.

Summary

Public methods

abstract LogFile getLogReportDir()

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

abstract void invocationEnded(long elapsedTime)

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

abstract void invocationStarted(IInvocationContext context)

Reports the start of the test invocation.

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

Save the log data.

abstract LogFile saveLogDataRaw(String dataName, String ext, InputStream dataStream)

A helper method to save the log data unmodified.

Public methods

getLogReportDir

LogFile getLogReportDir ()

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

Returns
LogFile The LogFile.

invocationEnded

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 invocationEnded(long) is called.

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

invocationStarted

void invocationStarted (IInvocationContext context)

Reports the start of the test invocation.

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

Parameters
context IInvocationContext: information about the invocation.

saveLogData

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

Save the log data.

Will be automatically called by the TradeFederation framework whenever testLog(String, LogDataType, 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 inaccessable 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 InputStream of the data.
Returns
LogFile the LogFile containing the path and URL of the saved file.
Throws
IOException if log file could not be generated

saveLogDataRaw

LogFile saveLogDataRaw (String dataName, 
                String ext, 
                InputStream dataStream)

A helper method to save the log data unmodified.

Logs may be stored in a location inaccessable to Tradefed.

Parameters
dataName String: a String descriptive name of the data. e.g. "device_logcat".
ext String: a String the extention of the file
dataStream InputStream: the InputStream of the data.
Returns
LogFile the LogFile containing the path and URL of the saved file.
Throws
IOException if log file could not be generated