記錄

public final class Log
extends Object

java.lang.Object
   ↳ com.android.tradefed.log.Log


Log 類別,可反映主要 Android 來源中的 API。

預設行為會將記錄輸出至 System.out。使用 setLogOutput(com.android.tradefed.log.Log.ILogOutput) 將記錄重新導向至其他位置。

摘要

巢狀類別

interface Log.ILogOutput

實作這個介面的類別會提供處理記錄訊息輸出的方法。 

公用方法

static void addLogger(Log.ILogOutput logOutput)
static void d(String tag, String message)

輸出 LogLevel.DEBUG 層級的訊息。

static void e(String tag, String message)

輸出 LogLevel.ERROR 層級的訊息。

static void e(String tag, Throwable throwable)

輸出 LogLevel.ERROR 層級 Throwable 資訊。

static String getLogFormatString(Log.LogLevel logLevel, String tag, String message)

格式化記錄訊息。

static void i(String tag, String message)

輸出 LogLevel.INFO 層級的訊息。

static void logAndDisplay(Log.LogLevel logLevel, String tag, String message)

輸出記錄訊息,並嘗試在對話方塊中顯示該訊息。

static void printLog(Log.LogLevel logLevel, String tag, String message)

列印記錄訊息。

static void removeLogger(Log.ILogOutput logOutput)
static void setLogOutput(Log.ILogOutput logOutput)

設定用於列印記錄的 ILogOutput

static void v(String tag, String message)

輸出 LogLevel.VERBOSE 層級的訊息。

static void w(String tag, String message)

輸出 LogLevel.WARN 層級的訊息。

公用方法

addLogger

public static void addLogger (Log.ILogOutput logOutput)

參數
logOutput Log.ILogOutput

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:要輸出的訊息。

printLog

public static void printLog (Log.LogLevel logLevel, 
                String tag, 
                String message)

列印記錄訊息。

removeLogger

public static void removeLogger (Log.ILogOutput logOutput)

參數
logOutput Log.ILogOutput

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:要輸出的訊息。