ILogSaver
public
interface
ILogSaver
com.android.tradefed.result.ILogSaver |
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 ILogSaverListener
s may save additional files
to the same location.
Summary
Public methods | |
---|---|
abstract
LogFile
|
getLogReportDir()
Get the |
default
void
|
init(IInvocationContext context)
Early notification of initialization, before any build information are available. |
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. |
default
LogFile
|
saveLogDataRaw(String dataName, LogDataType dataType, InputStream dataStream)
This method is deprecated.
Use |
default
LogFile
|
saveLogFile(String dataName, LogDataType dataType, File fileToLog)
Save the log file. |
Public methods
getLogReportDir
public abstract LogFile getLogReportDir ()
Get the LogFile
containing the path and/or URL of the directory where logs are saved.
Returns | |
---|---|
LogFile |
The LogFile . |
init
public void init (IInvocationContext context)
Early notification of initialization, before any build information are available. This allows to setup any requirements to receive logs.
Parameters | |
---|---|
context |
IInvocationContext : information about the invocation. |
invocationEnded
public abstract 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 abstract 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 abstract 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. |
Throws | |
---|---|
|
if log file could not be generated |
saveLogDataRaw
public LogFile saveLogDataRaw (String dataName, LogDataType dataType, InputStream dataStream)
This method is deprecated.
Use saveLogData(String, com.android.tradefed.result.LogDataType, InputStream)
instead
A helper method to save the log data unmodified.
Logs may be stored in a location inaccessible to Tradefed.
Parameters | |
---|---|
dataName |
String : a String descriptive name of the data. e.g. "device_logcat". |
dataType |
LogDataType : a LogDataType containing the type and the extension of the file |
dataStream |
InputStream : the ERROR(/InputStream) of the data. |
Returns | |
---|---|
LogFile |
the LogFile containing the path and URL of the saved file. |
Throws | |
---|---|
|
if log file could not be generated |
saveLogFile
public LogFile saveLogFile (String dataName, LogDataType dataType, File fileToLog)
Save the log file.
Will be automatically called by the TradeFederation framework whenever ITestLogger.testLog(String, com.android.tradefed.result.LogDataType, com.android.tradefed.result.InputStreamSource)
is called and the
stream references a file.
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. |
fileToLog |
File : the ERROR(/File) to save. |
Returns | |
---|---|
LogFile |
the LogFile containing the path and URL of the saved file. |
Throws | |
---|---|
|
if log file could not be generated |