記錄

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)

輸出 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 setLogOutput(Log.ILogOutput logOutput)

設定要用來列印記錄的 ILogOutput

static void v(String tag, String message)

輸出 LogLevel.VERBOSE 層級訊息。

static void w(String tag, String message)

輸出 LogLevel.WARN 層級訊息。

公用方法

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

printLog

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

輸出記錄訊息。

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