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

FileSystemLogSaver

public class FileSystemLogSaver
extends Object implements ILogSaver

java.lang.Object
   ↳ com.android.tradefed.result.FileSystemLogSaver


Save logs to a file system.

Summary

Public constructors

FileSystemLogSaver()

Public methods

LogFile getLogReportDir()

void invocationEnded(long elapsedTime)

void invocationStarted(IInvocationContext context)

Also, create a unique file system directory under report-dir/[branch/]build-id/test-tag/unique_dir for saving logs.

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

Will zip and save the log file if LogDataType#isCompressed() returns false for dataType and compressed-files is set, otherwise, the stream will be saved uncompressed.

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

void setCompressFiles(boolean compress)

Protected methods

File generateLogReportDir(IBuildInfo buildInfo, File reportDir)

An exposed method that allow subclass to customize generating path logic.

Public constructors

FileSystemLogSaver

public FileSystemLogSaver ()

Public methods

getLogReportDir

public LogFile getLogReportDir ()

Returns
LogFile

invocationEnded

public void invocationEnded (long elapsedTime)

Parameters
elapsedTime long

invocationStarted

public void invocationStarted (IInvocationContext context)

Also, create a unique file system directory under report-dir/[branch/]build-id/test-tag/unique_dir for saving logs. If the creation of the directory fails, will write logs to a temporary directory on the local file system.

Parameters
context IInvocationContext

saveLogData

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

Will zip and save the log file if LogDataType#isCompressed() returns false for dataType and compressed-files is set, otherwise, the stream will be saved uncompressed.

Parameters
dataName String

dataType LogDataType

dataStream InputStream

Returns
LogFile

saveLogDataRaw

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

Parameters
dataName String

dataType LogDataType

dataStream InputStream

Returns
LogFile

setCompressFiles

public void setCompressFiles (boolean compress)

Parameters
compress boolean

Protected methods

generateLogReportDir

protected File generateLogReportDir (IBuildInfo buildInfo, 
                File reportDir)

An exposed method that allow subclass to customize generating path logic.

Parameters
buildInfo IBuildInfo: the IBuildInfo

reportDir File: the ERROR(/File) for the report directory.

Returns
File The directory created.