StdoutLogger

public class StdoutLogger
extends Object implements ILeveledLogOutput

java.lang.Object
com.android.tradefed.log.StdoutLogger


一种 ILeveledLogOutput,用于将日志消息定向到 stdout。

摘要

公共构造函数

StdoutLogger()

公共方法

ILeveledLogOutput clone()
void closeLog()

关闭日志,并在关闭前执行所有必要的清理操作。

InputStreamSource getLog()

获取日志数据的快照流。

Log.LogLevel getLogLevel()

获取要显示的最低日志级别。

void init()

初始化日志,创建所有必需的 IO 资源。

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

当需要打印日志消息时发送,并尽可能在对话框中向用户显示。

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

当需要打印日志消息时发送。

void setLogLevel(Log.LogLevel logLevel)

设置要显示的最低日志级别。

公共构造函数

StdoutLogger

public StdoutLogger ()

公共方法

clone

public ILeveledLogOutput clone ()

返回
ILeveledLogOutput

closeLog

public void closeLog ()

关闭日志,并在关闭前执行所有必要的清理操作。

getLog

public InputStreamSource getLog ()

获取日志数据的快照流。

不得在 ILeveledLogOutput.closeLog() 之后调用。

返回的流不保证具有最佳性能。调用方可能希望将结果封装在 BufferedInputStream 中。

返回
InputStreamSource 日志数据的 InputStreamSource。如果不支持,可能会返回 null。

getLogLevel

public Log.LogLevel getLogLevel ()

获取要显示的最低日志级别。

返回
Log.LogLevel 当前 LogLevel

init

public void init ()

初始化日志,创建所有必需的 IO 资源。

抛出
IOException

printAndPromptLog

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

当需要打印日志消息时发送,并尽可能在 对话框中向用户显示。

参数
logLevel Log.LogLevel:表示消息优先级的 LogLevel 枚举。

tag String:与消息关联的标记。

message String:要显示的消息。

printLog

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

当需要打印日志消息时发送。

参数
logLevel Log.LogLevel:表示消息优先级的 LogLevel 枚举。

tag String:与消息关联的标记。

message String:要显示的消息。

setLogLevel

public void setLogLevel (Log.LogLevel logLevel)

设置要显示的最低日志级别。

参数
logLevel Log.LogLevel:要显示的 LogLevel