LogUtil.CLog
public
static
class
LogUtil.CLog
extends Object
| java.lang.Object | |
| ↳ | com.android.tradefed.log.LogUtil.CLog |
Log 的 shim 类,会自动使用调用方的简单类名称作为日志标签
摘要
字段 | |
|---|---|
protected
static
final
String |
CLASS_NAME
|
公共构造函数 | |
|---|---|
CLog()
|
|
公共方法 | |
|---|---|
static
void
|
d(String message)
|
static
void
|
d(String format, Object... args)
|
static
void
|
e(String message)
|
static
void
|
e(String format, Object... args)
|
static
void
|
e(Throwable t)
|
static
String
|
findCallerClassName()
查找直接调用 CLog 方法的外部类名称。 |
static
String
|
findCallerClassName(Throwable t)
查找直接调用 CLog 方法的外部类名称。 |
static
String
|
getClassName(int frame)
从调用路径中的 |
static
void
|
i(String format, Object... args)
|
static
void
|
i(String message)
|
static
void
|
logAndDisplay(Log.LogLevel logLevel, String format, Object... args)
|
static
void
|
logAndDisplay(Log.LogLevel logLevel, String format, Object... args)
|
static
void
|
logAndDisplay(Log.LogLevel logLevel, String message)
|
static
void
|
logAndDisplay(Log.LogLevel logLevel, String message)
|
static
String
|
parseClassName(String fullName)
从完整类名称中解析出简单类名称。 |
static
void
|
v(String message)
|
static
void
|
v(String format, Object... args)
|
static
void
|
w(Throwable t)
|
static
void
|
w(String message)
|
static
void
|
w(String format, Object... args)
|
static
void
|
wtf(String message)
糟糕的失败:报告了绝不应发生的条件。 |
static
void
|
wtf(Throwable t)
糟糕的失败:报告了绝不应发生的条件。 |
static
void
|
wtf(String format, Object... args)
糟糕的失败:报告了绝不应发生的条件。 |
static
void
|
wtf(String message, Throwable t)
糟糕的失败:报告了绝不应发生的条件。 |
字段
CLASS_NAME
protected static final String CLASS_NAME
公共构造函数
CLog
public CLog ()
公共方法
d
public static void d (String message)
Log.d(String, String) 的 shim 版本。
| 参数 | |
|---|---|
message |
String:要记录的 String |
d
public static void d (String format,
Object... args)Log.d(String, String) 的 shim 版本。为方便起见,还会调用 String.format。
| 参数 | |
|---|---|
format |
String:要记录的消息的格式字符串 |
args |
Object:格式字符串参数 |
e
public static void e (String message)
Log.e(String, String) 的 shim 版本。
| 参数 | |
|---|---|
message |
String:要记录的 String |
e
public static void e (String format,
Object... args)Log.e(String, String) 的 shim 版本。为方便起见,还会调用 String.format。
| 参数 | |
|---|---|
format |
String:要记录的消息的格式字符串 |
args |
Object:格式字符串参数 |
e
public static void e (Throwable t)
Log.e(String, Throwable) 的 shim 版本。
| 参数 | |
|---|---|
t |
Throwable:要输出的 Throwable。 |
findCallerClassName
public static String findCallerClassName ()
查找直接调用 CLog 方法的外部类名称。
| 返回 | |
|---|---|
String |
调用了 CLog 方法的外部类的简单类名称(如果在获取对类的引用时发生错误,则为完全限定类名称),如果堆栈轨迹为空或仅包含 CLog 类名称,则为“未知”。 |
findCallerClassName
public static String findCallerClassName (Throwable t)
查找直接调用 CLog 方法的外部类名称。
| 参数 | |
|---|---|
t |
Throwable:(可选)要搜索的堆栈轨迹,用于单元测试 |
| 返回 | |
|---|---|
String |
调用了 CLog 方法的外部类的简单类名称(如果在获取对类的引用时发生错误,则为完全限定类名称),如果堆栈轨迹为空或仅包含 CLog 类名称,则为“未知”。 |
getClassName
public static String getClassName (int frame)
从调用路径中的 frame 个栈帧返回简单类名称。注意:此方法
| 参数 | |
|---|---|
frame |
int:要检查类名称的堆栈轨迹帧的索引 |
| 返回 | |
|---|---|
String |
堆栈轨迹的给定元素的简单类名称(如果在获取对类的引用时发生错误,则为完全限定名称)。 |
I
public static void i (String format,
Object... args)Log.i(String, String) 的 shim 版本。为方便起见,还会调用 String.format。
| 参数 | |
|---|---|
format |
String:要记录的消息的格式字符串 |
args |
Object:格式字符串参数 |
I
public static void i (String message)
Log.i(String, String) 的 shim 版本。
| 参数 | |
|---|---|
message |
String:要记录的 String |
logAndDisplay
public static void logAndDisplay (Log.LogLevel logLevel, String format, Object... args)
| 参数 | |
|---|---|
logLevel |
Log.LogLevel:LogLevel |
format |
String:要记录的消息的格式字符串 |
args |
Object:格式字符串参数 |
logAndDisplay
public static void logAndDisplay (Log.LogLevel logLevel,
String format,
Object... args)| 参数 | |
|---|---|
logLevel |
Log.LogLevel:LogLevel |
format |
String:要记录的消息的格式字符串 |
args |
Object:格式字符串参数 |
logAndDisplay
public static void logAndDisplay (Log.LogLevel logLevel,
String message)| 参数 | |
|---|---|
logLevel |
Log.LogLevel:LogLevel |
message |
String:要记录的 String |
logAndDisplay
public static void logAndDisplay (Log.LogLevel logLevel, String message)
| 参数 | |
|---|---|
logLevel |
Log.LogLevel |
message |
String |
parseClassName
public static String parseClassName (String fullName)
从完整类名称中解析出简单类名称。如果格式已经看起来像一个简单的类名称,则只需返回该名称。
| 参数 | |
|---|---|
fullName |
String:要解析的完整类名称 |
| 返回 | |
|---|---|
String |
简单的类名称 |
v
public static void v (String message)
Log.v(String, String) 的 shim 版本。
| 参数 | |
|---|---|
message |
String:要记录的 String |
v
public static void v (String format,
Object... args)Log.v(String, String) 的 shim 版本。为方便起见,还会调用 String.format。
| 参数 | |
|---|---|
format |
String:要记录的消息的格式字符串 |
args |
Object:格式字符串参数 |
W
public static void w (Throwable t)
Log.w(String, String) 的变体,其中会设置提供的 Throwable 的堆栈轨迹的格式并将其记录到日志中。
| 参数 | |
|---|---|
t |
Throwable:要记录的 Throwable |
W
public static void w (String message)
Log.w(String, String) 的 shim 版本。
| 参数 | |
|---|---|
message |
String:要记录的 String |
W
public static void w (String format,
Object... args)Log.w(String, String) 的 shim 版本。为方便起见,还会调用 String.format。
| 参数 | |
|---|---|
format |
String:要记录的消息的格式字符串 |
args |
Object:格式字符串参数 |
wtf
public static void wtf (String message)
糟糕的失败:报告了绝不应发生的条件。 系统始终会在 ASSERT 级别记录该错误以及调用堆栈。
| 参数 | |
|---|---|
message |
String:您要记录的消息。 |
wtf
public static void wtf (Throwable t)
糟糕的失败:报告了绝不应发生的条件。 系统始终会在 ASSERT 级别记录该错误以及调用堆栈。
| 参数 | |
|---|---|
t |
Throwable:(可选)要记录的异常。如果为 null,则仅会记录消息。 |
wtf
public static void wtf (String format,
Object... args)糟糕的失败:报告了绝不应发生的条件。 系统将始终在 ASSERT 级别记录该错误以及调用堆栈。为方便起见,还会调用 String.format。
| 参数 | |
|---|---|
format |
String:要记录的消息的格式字符串 |
args |
Object:格式字符串参数 |
wtf
public static void wtf (String message,
Throwable t)糟糕的失败:报告了绝不应发生的条件。 系统始终会在 ASSERT 级别记录该错误以及调用堆栈。
| 参数 | |
|---|---|
message |
String:您要记录的消息。 |
t |
Throwable:(可选)要记录的异常。如果为 null,则仅会记录消息。 |