com.android.ddmlib
Class Log

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

public final class Log
extends Object

Log class that mirrors the API in main Android sources.

Default behavior outputs the log to System.out. Use setLogOutput(com.android.ddmlib.Log.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 d(String tag, String message)
          Outputs a Log.LogLevel.DEBUG level message.
static void e(String tag, String message)
          Outputs a Log.LogLevel.ERROR level message.
static void e(String tag, Throwable throwable)
          Outputs a Log.LogLevel.ERROR level Throwable information.
static String getLogFormatString(Log.LogLevel logLevel, String tag, String message)
          Formats a log message.
static void i(String tag, String message)
          Outputs a Log.LogLevel.INFO level message.
static void logAndDisplay(Log.LogLevel logLevel, String tag, String message)
          Outputs a log message and attempts to display it in a dialog.
static void printLog(Log.LogLevel logLevel, String tag, String message)
          Prints a log message.
static void setLogOutput(Log.ILogOutput logOutput)
          Sets the Log.ILogOutput to use to print the logs.
static void v(String tag, String message)
          Outputs a Log.LogLevel.VERBOSE level message.
static void w(String tag, 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(String tag,
                     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(String tag,
                     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(String tag,
                     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(String tag,
                     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(String tag,
                     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,
                                 String tag,
                                 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(String tag,
                     Throwable throwable)
Outputs a Log.LogLevel.ERROR level Throwable information.

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

setLogOutput

public static void setLogOutput(Log.ILogOutput logOutput)
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.

printLog

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

Parameters:
logLevel -
tag -
message -

getLogFormatString

public static String getLogFormatString(Log.LogLevel logLevel,
                                        String tag,
                                        String message)
Formats a log message.

Parameters:
logLevel -
tag -
message -


Copyright © 2008-2012. All Rights Reserved.