LogUtil

public class LogUtil
extends Object

java.lang.Object
   ↳ com.android.tradefed.log.LogUtil


一个日志记录实用程序类。适用于需要替换 Log 中的静态方法的代码

摘要

嵌套类

class LogUtil.CLog

Log 的 shim 类,会自动使用调用方的简单类名称作为日志标签

公共方法

static String getLogFormatString(Log.LogLevel logLevel, String tag, String message)

创建一个与设备上的“threadtime”日志格式类似的格式字符串。

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

在需要输出日志消息时发送。

公共方法

getLogFormatString

public static String getLogFormatString (Log.LogLevel logLevel, 
                String tag, 
                String message)

创建一个格式字符串,该字符串类似于设备上的“threadtime”日志格式。这非常有用,因为它包含日期和月份(用于区分长时间运行的 TF 实例的时间),并且还使用 24 小时制时间来区分上午和晚上。

参数
logLevel Log.LogLevel

tag String

message String

返回
String

printLog

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

在需要输出日志消息时发送。在所有情况下,此实现都会将消息输出到标准输出。

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

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

message String:要显示的消息。