com.android.ddmlib
Class Log

java.lang.Object
  extended by com.android.ddmlib.Log

public final class Log
extends java.lang.Object

Log class that mirrors the API in main Android sources.

Default behavior outputs the log to System.out. Use addLogger(ILogOutput) to redirect the log somewhere else.


Nested Class Summary
static interface Log.ILogOutput
          Classes which implement this interface provides methods that deal with outputting log messages.
static class Log.LogLevel
          Log Level enum.
 
Method Summary
static void addLogger(Log.ILogOutput logOutput)
           
static void d(java.lang.String tag, java.lang.String message)
          Outputs a Log.LogLevel.DEBUG level message.
static void e(java.lang.String tag, java.lang.String message)
          Outputs a Log.LogLevel.ERROR level message.
static void e(java.lang.String tag, java.lang.Throwable throwable)
          Outputs a Log.LogLevel.ERROR level Throwable information.
static java.lang.String getLogFormatString(Log.LogLevel logLevel, java.lang.String tag, java.lang.String message)
           
static void i(java.lang.String tag, java.lang.String message)
          Outputs a Log.LogLevel.INFO level message.
static void logAndDisplay(Log.LogLevel logLevel, java.lang.String tag, java.lang.String message)
          Outputs a log message and attempts to display it in a dialog.
static void printLog(Log.LogLevel logLevel, java.lang.String tag, java.lang.String message)
           
static void removeLogger(Log.ILogOutput logOutput)
           
static void setLogOutput(Log.ILogOutput logOutput)
          Deprecated. Use addLogger(ILogOutput) instead.

Sets the Log.ILogOutput to use to print the logs. If not set, System.out will be used.

static void v(java.lang.String tag, java.lang.String message)
          Outputs a Log.LogLevel.VERBOSE level message.
static void w(java.lang.String tag, java.lang.String message)
          Outputs a Log.LogLevel.WARN level message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

v

public static void v(java.lang.String tag,
                     java.lang.String message)
Outputs a Log.LogLevel.VERBOSE level message.

Parameters:
tag - The tag associated with the message.
message - The message to output.

d

public static void d(java.lang.String tag,
                     java.lang.String message)
Outputs a Log.LogLevel.DEBUG level message.

Parameters:
tag - The tag associated with the message.
message - The message to output.

i

public static void i(java.lang.String tag,
                     java.lang.String message)
Outputs a Log.LogLevel.INFO level message.

Parameters:
tag - The tag associated with the message.
message - The message to output.

w

public static void w(java.lang.String tag,
                     java.lang.String message)
Outputs a Log.LogLevel.WARN level message.

Parameters:
tag - The tag associated with the message.
message - The message to output.

e

public static void e(java.lang.String tag,
                     java.lang.String message)
Outputs a Log.LogLevel.ERROR level message.

Parameters:
tag - The tag associated with the message.
message - The message to output.

logAndDisplay

public static void logAndDisplay(Log.LogLevel logLevel,
                                 java.lang.String tag,
                                 java.lang.String message)
Outputs a log message and attempts to display it in a dialog.

Parameters:
tag - The tag associated with the message.
message - The message to output.

e

public static void e(java.lang.String tag,
                     java.lang.Throwable throwable)
Outputs a Log.LogLevel.ERROR level Throwable information.

Parameters:
tag - The tag associated with the message.
throwable - The Throwable to output.

setLogOutput

@Deprecated
public static void setLogOutput(Log.ILogOutput logOutput)
Deprecated. Use addLogger(ILogOutput) instead.

Sets the Log.ILogOutput to use to print the logs. If not set, System.out will be used.

Parameters:
logOutput - The Log.ILogOutput to use to print the log.

addLogger

public static void addLogger(@NonNull
                             Log.ILogOutput logOutput)

removeLogger

public static void removeLogger(@NonNull
                                Log.ILogOutput logOutput)

printLog

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

getLogFormatString

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