FileSystemLogSaver
public
class
FileSystemLogSaver
extends Object
implements
ILogSaver
java.lang.Object | |
↳ | com.android.tradefed.result.FileSystemLogSaver |
將記錄儲存至檔案系統。
摘要
公用建構函式 | |
---|---|
FileSystemLogSaver()
|
公用方法 | |
---|---|
LogFile
|
getLogReportDir()
取得包含記錄儲存目錄路徑和/或網址的 |
void
|
invocationEnded(long elapsedTime)
回報叫用已終止,無論是成功或因某些錯誤條件而終止。 |
void
|
invocationStarted(IInvocationContext context)
回報測試叫用作業的開始時間。 此外,請在 |
LogFile
|
saveLogData(String dataName, LogDataType dataType, InputStream dataStream)
儲存記錄資料。
如果 |
LogFile
|
saveLogFile(String dataName, LogDataType dataType, File fileToLog)
儲存記錄檔。 |
void
|
setCompressFiles(boolean compress)
|
受保護的方法 | |
---|---|
File
|
generateLogReportDir(IBuildInfo buildInfo, File reportDir)
公開的方法,可讓子類別自訂產生路徑邏輯。 |
公用建構函式
FileSystemLogSaver
public FileSystemLogSaver ()
公用方法
invocationEnded
public void invocationEnded (long elapsedTime)
回報叫用已終止,無論是成功或因某些錯誤條件而終止。
系統會在呼叫 ITestInvocationListener.invocationEnded(long)
後,自動呼叫 TradeFederation 架構。
參數 | |
---|---|
elapsedTime |
long :叫用作業的經過時間 (以毫秒為單位) |
invocationStarted
public void invocationStarted (IInvocationContext context)
回報測試叫用作業的開始時間。
會在 ITestInvocationListener.invocationStarted(IInvocationContext)
呼叫前,由 TradeFederation 架構自動呼叫。
此外,請在 report-dir/[branch/]build-id/test-tag/unique_dir
下建立專屬的檔案系統目錄,用於儲存記錄。如果建立目錄失敗,系統會將記錄寫入本機檔案系統的暫存目錄。
參數 | |
---|---|
context |
IInvocationContext :叫用作業相關資訊。 |
saveLogData
public LogFile saveLogData (String dataName, LogDataType dataType, InputStream dataStream)
儲存記錄資料。
每當呼叫 ITestLogger.testLog(String, com.android.tradefed.result.LogDataType, com.android.tradefed.result.InputStreamSource)
時,TradeFederation 架構就會自動呼叫此函式。您也可以將其用作輔助方法,儲存其他記錄資料。
視導入方式和政策而定,記錄可能會以壓縮格式儲存。記錄也可以儲存在 Tradefed 無法存取的位置。
如果 LogDataType.isCompressed()
針對 dataType
傳回 false,且已設定 compressed-files
,系統就會壓縮並儲存記錄檔案;否則,系統會未經壓縮就儲存資料流。
參數 | |
---|---|
dataName |
String :資料的String 描述性名稱,例如「device_logcat」 |
dataType |
LogDataType :檔案的 LogDataType 。 |
dataStream |
InputStream :資料的 ERROR(/InputStream) 。 |
傳回 | |
---|---|
LogFile |
LogFile 包含儲存檔案的路徑和網址。 |
saveLogFile
public LogFile saveLogFile (String dataName, LogDataType dataType, File fileToLog)
儲存記錄檔。
只要呼叫 ITestLogger.testLog(String, com.android.tradefed.result.LogDataType, com.android.tradefed.result.InputStreamSource)
且串流參照檔案,TradeFederation 架構就會自動呼叫此方法。
視導入方式和政策而定,記錄可能會以壓縮格式儲存。記錄也可能儲存在 Tradefed 無法存取的位置。
參數 | |
---|---|
dataName |
String :資料的String 描述性名稱,例如「device_logcat」 |
dataType |
LogDataType :檔案的 LogDataType 。 |
fileToLog |
File :要儲存的 ERROR(/File) 。 |
傳回 | |
---|---|
LogFile |
LogFile 包含儲存檔案的路徑和網址。 |
setCompressFiles
public void setCompressFiles (boolean compress)
參數 | |
---|---|
compress |
boolean |
受保護的方法
generateLogReportDir
protected File generateLogReportDir (IBuildInfo buildInfo, File reportDir)
公開的方法,可讓子類別自訂產生路徑邏輯。
參數 | |
---|---|
buildInfo |
IBuildInfo :IBuildInfo |
reportDir |
File :報表目錄的 ERROR(/File) 。 |
傳回 | |
---|---|
File |
已建立的目錄。 |