FileLogger

public class FileLogger
extends BaseLeveledLogOutput

java.lang.Object
   ↳ com.android.tradefed.log.BaseLeveledLogOutput
     ↳ com.android.tradefed.log.FileLogger


A ILeveledLogOutput that directs log messages to a file and to stdout.

Summary

Public constructors

FileLogger()

Public methods

ILeveledLogOutput clone()

Creates a new FileLogger with the same log level settings as the current object.

void closeLog()

InputStreamSource getLog()

Log.LogLevel getLogLevel()

long getMaxLogSizeMbytes()

Returns the max log size of the log in MBytes.

void init()

void printAndPromptLog(Log.LogLevel logLevel, String tag, String message)

void printLog(Log.LogLevel logLevel, String tag, String message)

void setLogLevel(Log.LogLevel logLevel)

Protected methods

void init(String logPrefix, String fileSuffix)

Alternative to init() where we can specify the file name and suffix.

Public constructors

FileLogger

public FileLogger ()

Public methods

clone

public ILeveledLogOutput clone ()

Creates a new FileLogger with the same log level settings as the current object.

Does not copy underlying log file content (ie the clone's log data will be written to a new file.)

Returns
ILeveledLogOutput

closeLog

public void closeLog ()

getLog

public InputStreamSource getLog ()

Returns
InputStreamSource

getLogLevel

public Log.LogLevel getLogLevel ()

Returns
Log.LogLevel

getMaxLogSizeMbytes

public long getMaxLogSizeMbytes ()

Returns the max log size of the log in MBytes.

Returns
long

init

public void init ()

Throws
IOException

printAndPromptLog

public void printAndPromptLog (Log.LogLevel logLevel, 
                String tag, 
                String message)

Parameters
logLevel Log.LogLevel

tag String

message String

printLog

public void printLog (Log.LogLevel logLevel, 
                String tag, 
                String message)

Parameters
logLevel Log.LogLevel

tag String

message String

setLogLevel

public void setLogLevel (Log.LogLevel logLevel)

Parameters
logLevel Log.LogLevel

Protected methods

init

protected void init (String logPrefix, 
                String fileSuffix)

Alternative to init() where we can specify the file name and suffix.

Parameters
logPrefix String: the file name where to log without extension.

fileSuffix String: the extension of the file where to log.