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 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) What a Terrible Failure:報告一個不應該發生的情況。 |
static void | wtf (Throwable t) What a Terrible Failure:報告一個不應該發生的情況。 |
static void | wtf (String format, Object... args) What a Terrible Failure:報告一個不應該發生的情況。 |
static void | wtf (String message, Throwable t) What a Terrible Failure:報告一個不應該發生的情況。 |
領域
班級名稱
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 :格式字符串參數 |
電子
public static void e (String format, Object... args)
Log#e(String, String)
的墊片版本。為方便起見,還調用 String.format。
參數 | |
---|---|
format | String :要記錄的消息的格式字符串 |
args | Object :格式字符串參數 |
電子
public static void e (Throwable t)
Log#e(String, Throwable)
的墊片版本。
參數 | |
---|---|
t | Throwable :要輸出的ERROR(/Throwable) 。 |
查找調用者類名
public static String findCallerClassName ()
查找直接調用 CLog 方法的外部類名。
退貨 | |
---|---|
String | 調用 CLog 方法的外部類的簡單類名(如果在獲取類的引用時發生錯誤,則為全限定名),如果堆棧跟踪為空或僅包含 CLog 類名,則為“Unknown”。 |
查找調用者類名
public static String findCallerClassName (Throwable t)
查找直接調用 CLog 方法的外部類名。
參數 | |
---|---|
t | Throwable :(可選)要在其中搜索的堆棧跟踪,用於單元測試 |
退貨 | |
---|---|
String | 調用 CLog 方法的外部類的簡單類名(如果在獲取類的引用時發生錯誤,則為全限定名),如果堆棧跟踪為空或僅包含 CLog 類名,則為“Unknown”。 |
獲取類名
public static String getClassName (int frame)
從調用路徑中的frame
th 個堆棧幀返回簡單類名。注意:此方法確實
參數 | |
---|---|
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)
的一種變體,其中對提供的ERROR(/Throwable)
的堆棧跟踪進行格式化和記錄。
參數 | |
---|---|
t | Throwable :要記錄的ERROR(/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)
What a Terrible Failure:報告一個不應該發生的情況。錯誤將始終記錄在帶有調用堆棧的 ASSERT 級別。
參數 | |
---|---|
message | String :您要記錄的消息。 |
臥槽
public static void wtf (Throwable t)
What a Terrible Failure:報告一個不應該發生的情況。錯誤將始終記錄在帶有調用堆棧的 ASSERT 級別。
參數 | |
---|---|
t | Throwable :(可選)要記錄的異常。如果為空,則只會記錄消息。 |
臥槽
public static void wtf (String format, Object... args)
What a Terrible Failure:報告一個不應該發生的情況。錯誤將始終記錄在帶有調用堆棧的 ASSERT 級別。為方便起見,還調用 String.format。
參數 | |
---|---|
format | String :要記錄的消息的格式字符串 |
args | Object :格式字符串參數 |
臥槽
public static void wtf (String message, Throwable t)
What a Terrible Failure:報告一個不應該發生的情況。錯誤將始終記錄在帶有調用堆棧的 ASSERT 級別。
參數 | |
---|---|
message | String :您要記錄的消息。 |
t | Throwable :(可選)要記錄的異常。如果為空,則只會記錄消息。 |