日志
public
final
class
Log
extends Object
| java.lang.Object | |
| ↳ | com.android.tradefed.log.Log |
用于在主要 Android 源代码中镜像 API 的日志类。
默认行为会将日志输出到 System.out。使用 setLogOutput(com.android.tradefed.log.Log.ILogOutput) 将日志重定向到其他位置。
摘要
嵌套类 | |
|---|---|
interface |
Log.ILogOutput
实现此接口的类提供了用于处理输出日志消息的方法。 |
公共方法 | |
|---|---|
static
void
|
d(String tag, String message)
输出 |
static
void
|
e(String tag, String message)
输出 |
static
void
|
e(String tag, Throwable throwable)
输出 |
static
String
|
getLogFormatString(Log.LogLevel logLevel, String tag, String message)
设置日志消息的格式。 |
static
void
|
i(String tag, String message)
输出 |
static
void
|
logAndDisplay(Log.LogLevel logLevel, String tag, String message)
输出日志消息并尝试在对话框中显示该消息。 |
static
void
|
printLog(Log.LogLevel logLevel, String tag, String message)
输出日志消息。 |
static
void
|
setLogOutput(Log.ILogOutput logOutput)
设置用于输出日志的 |
static
void
|
v(String tag, String message)
输出 |
static
void
|
w(String tag, String message)
输出 |
公共方法
d
public static void d (String tag,
String message)输出 LogLevel.DEBUG 级别消息。
| 参数 | |
|---|---|
tag |
String:与消息关联的标记。 |
message |
String:要输出的消息。 |
e
public static void e (String tag,
String message)输出 LogLevel.ERROR 级别消息。
| 参数 | |
|---|---|
tag |
String:与消息关联的标记。 |
message |
String:要输出的消息。 |
e
public static void e (String tag,
Throwable throwable)输出 LogLevel.ERROR 级 Throwable 信息。
| 参数 | |
|---|---|
tag |
String:与消息关联的标记。 |
throwable |
Throwable:要输出的 Throwable。 |
getLogFormatString
public static String getLogFormatString (Log.LogLevel logLevel, String tag, String message)
设置日志消息的格式。
| 返回 | |
|---|---|
String |
|
I
public static void i (String tag,
String message)输出 LogLevel.INFO 级别消息。
| 参数 | |
|---|---|
tag |
String:与消息关联的标记。 |
message |
String:要输出的消息。 |
logAndDisplay
public static void logAndDisplay (Log.LogLevel logLevel, String tag, String message)
输出日志消息并尝试在对话框中显示该消息。
| 参数 | |
|---|---|
logLevel |
Log.LogLevel |
tag |
String:与消息关联的标记。 |
message |
String:要输出的消息。 |
setLogOutput
public static void setLogOutput (Log.ILogOutput logOutput)
设置用于输出日志的 ILogOutput。如果未设置,则系统会使用 System.out。
| 参数 | |
|---|---|
logOutput |
Log.ILogOutput:用于输出日志的 ILogOutput。 |
v
public static void v (String tag,
String message)输出 LogLevel.VERBOSE 级别消息。
| 参数 | |
|---|---|
tag |
String:与消息关联的标记。 |
message |
String:要输出的消息。 |
W
public static void w (String tag,
String message)输出 LogLevel.WARN 级别消息。
| 参数 | |
|---|---|
tag |
String:与消息关联的标记。 |
message |
String:要输出的消息。 |