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) 从调用路径中的第 3 |
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 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) 多么可怕的失败:报告一个不应该发生的情况。 |
领域
班级名称
protected static final String CLASS_NAME
公共构造函数
阻塞
public CLog ()
公共方法
d
public static void d (String format, Object... args)
Log#d(String, String)
的垫片版本。为了方便起见,还调用 String.format。
参数 | |
---|---|
format | String :要记录的消息的格式字符串 |
args | Object :格式字符串参数 |
e
public static void e (String format, Object... args)
Log#e(String, String)
的垫片版本。为了方便起见,还调用 String.format。
参数 | |
---|---|
format | String :要记录的消息的格式字符串 |
args | Object :格式字符串参数 |
查找调用者类名
public static String findCallerClassName ()
查找直接调用 CLog 方法的外部类名。
退货 | |
---|---|
String | 调用 CLog 方法的外部类的简单类名称(如果获取类的引用时发生错误,则为完全限定名称);如果堆栈跟踪为空或仅包含 CLog 类名称,则为“未知”。 |
查找调用者类名
public static String findCallerClassName (Throwable t)
查找直接调用 CLog 方法的外部类名。
参数 | |
---|---|
t | Throwable :(可选)要在其中搜索的堆栈跟踪,公开用于单元测试 |
退货 | |
---|---|
String | 调用 CLog 方法的外部类的简单类名称(如果获取类的引用时发生错误,则为完全限定名称);如果堆栈跟踪为空或仅包含 CLog 类名称,则为“未知”。 |
获取类名
public static String getClassName (int frame)
从调用路径中的第 3 frame
堆栈帧返回简单类名。注意:该方法的作用是
参数 | |
---|---|
frame | int :用于检查类名的堆栈跟踪帧的索引 |
退货 | |
---|---|
String | 堆栈跟踪的给定元素的简单类名称(如果在获取类引用时发生错误,则为完全限定名称)。 |
我
public static void i (String format, Object... args)
Log#i(String, String)
的垫片版本。为了方便起见,还调用 String.format。
参数 | |
---|---|
format | String :要记录的消息的格式字符串 |
args | Object :格式字符串参数 |
日志和显示
public static void logAndDisplay (Log.LogLevel logLevel, String format, Object... args)
Log#logAndDisplay(LogLevel, String, String)
的垫片版本。
参数 | |
---|---|
logLevel | Log.LogLevel : LogLevel |
format | String :要记录的消息的格式字符串 |
args | Object :格式字符串参数 |
日志和显示
public static void logAndDisplay (Log.LogLevel logLevel, String message)
Log#logAndDisplay(LogLevel, String, String)
的垫片版本。
参数 | |
---|---|
logLevel | Log.LogLevel : LogLevel |
message | String : 要记录的String |
解析类名
public static String parseClassName (String fullName)
从完整的类名中解析出简单的类名。如果格式看起来已经像一个简单的类名,那么就返回它。
参数 | |
---|---|
fullName | String :要解析的完整类名 |
退货 | |
---|---|
String | 简单的类名 |
v
public static void v (String format, Object... args)
Log#v(String, String)
的垫片版本。为了方便起见,还调用 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 format, Object... args)
Log#w(String, String)
的垫片版本。为了方便起见,还调用 String.format。
参数 | |
---|---|
format | String :要记录的消息的格式字符串 |
args | Object :格式字符串参数 |
哇哦
public static void wtf (String message)
多么可怕的失败:报告一个不应该发生的情况。错误将始终通过调用堆栈记录在 ASSERT 级别。
参数 | |
---|---|
message | String :您想要记录的消息。 |
哇哦
public static void wtf (Throwable t)
多么可怕的失败:报告一个不应该发生的情况。错误将始终通过调用堆栈记录在 ASSERT 级别。
参数 | |
---|---|
t | Throwable :(可选)要记录的异常。如果为空,则仅记录消息。 |
哇哦
public static void wtf (String format, Object... args)
多么可怕的失败:报告一个不应该发生的情况。错误将始终通过调用堆栈记录在 ASSERT 级别。为了方便起见,还调用 String.format。
参数 | |
---|---|
format | String :要记录的消息的格式字符串 |
args | Object :格式字符串参数 |
哇哦
public static void wtf (String message, Throwable t)
多么可怕的失败:报告一个不应该发生的情况。错误将始终通过调用堆栈记录在 ASSERT 级别。
参数 | |
---|---|
message | String :您想要记录的消息。 |
t | Throwable :(可选)要记录的异常。如果为空,则仅记录消息。 |