LogUtil
public
class
LogUtil
extends Object
| java.lang.Object | |
| ↳ | com.android.tradefed.log.LogUtil |
一个日志记录实用程序类。对于需要替换 Log 中静态方法的代码非常有用
摘要
嵌套类 | |
|---|---|
class |
LogUtil.CLog
|
公共方法 | |
|---|---|
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)
在需要打印日志消息时发送。此实现会在所有情况下将消息输出到 stdout。
| 参数 | |
|---|---|
logLevel |
Log.LogLevel:表示消息优先级的 LogLevel 枚举。 |
tag |
String:与消息关联的标记。 |
message |
String:要显示的消息。 |