to top
public static class

LogUtil.CLog

extends Object
java.lang.Object
   ↳ com.android.tradefed.log.LogUtil.CLog

Class Overview

A shim class for Log that automatically uses the simple classname of the caller as the log tag

Summary

Fields
protected static final String CLASS_NAME
Public Constructors
LogUtil.CLog()
Public Methods
static void d(String message)
The shim version of d(String, String).
static void d(String format, Object... args)
The shim version of d(String, String).
static void e(String format, Object... args)
The shim version of e(String, String).
static void e(String message)
The shim version of e(String, String).
static void e(Throwable t)
The shim version of e(String, Throwable).
static String findCallerClassName(Throwable t)
Finds the external class name that directly called a CLog method.
static String findCallerClassName()
Finds the external class name that directly called a CLog method.
static String getClassName(int frame)
Return the simple classname from the frameth stack frame in the call path.
static void i(String message)
The shim version of i(String, String).
static void i(String format, Object... args)
The shim version of i(String, String).
static void logAndDisplay(Log.LogLevel logLevel, String format, Object... args)
static void setGlobalConfigInstance(IGlobalConfiguration globalConfig)
Sets the GlobalConfiguration instance for CLog to use - exposed for unit testing
static void v(String format, Object... args)
The shim version of v(String, String).
static void v(String message)
The shim version of v(String, String).
static void w(String message)
The shim version of w(String, String).
static void w(String format, Object... args)
The shim version of w(String, String).
static void wtf(String message, Throwable t)
What a Terrible Failure: Report a condition that should never happen.
static void wtf(Throwable t)
What a Terrible Failure: Report a condition that should never happen.
static void wtf(String format, Object... args)
What a Terrible Failure: Report a condition that should never happen.
static void wtf(String message)
What a Terrible Failure: Report a condition that should never happen.
[Expand]
Inherited Methods
From class java.lang.Object

Fields

protected static final String CLASS_NAME

Public Constructors

public LogUtil.CLog ()

Public Methods

public static void d (String message)

The shim version of d(String, String).

Parameters
message The String to log

public static void d (String format, Object... args)

The shim version of d(String, String). Also calls String.format for convenience.

Parameters
format A format string for the message to log
args The format string arguments

public static void e (String format, Object... args)

The shim version of e(String, String). Also calls String.format for convenience.

Parameters
format A format string for the message to log
args The format string arguments

public static void e (String message)

The shim version of e(String, String).

Parameters
message The String to log

public static void e (Throwable t)

The shim version of e(String, Throwable).

Parameters
t the Throwable to output.

public static String findCallerClassName (Throwable t)

Finds the external class name that directly called a CLog method.

Parameters
t (Optional) the stack trace to search within, exposed for unit testing
Returns
  • The simple class name (or full-qualified if an error occurs getting a ref to the class) of the external class that called a CLog method, or "Unknown" if the stack trace is empty or only contains CLog class names.

public static String findCallerClassName ()

Finds the external class name that directly called a CLog method.

Returns
  • The simple class name (or full-qualified if an error occurs getting a ref to the class) of the external class that called a CLog method, or "Unknown" if the stack trace is empty or only contains CLog class names.

public static String getClassName (int frame)

Return the simple classname from the frameth stack frame in the call path. Note: this method does not check array bounds for the stack trace length.

Parameters
frame The index of the stack trace frame to inspect for the class name
Returns
  • The simple class name (or full-qualified if an error occurs getting a ref to the class) for the given element of the stack trace.

public static void i (String message)

The shim version of i(String, String).

Parameters
message The String to log

public static void i (String format, Object... args)

The shim version of i(String, String). Also calls String.format for convenience.

Parameters
format A format string for the message to log
args The format string arguments

public static void logAndDisplay (Log.LogLevel logLevel, String format, Object... args)

Parameters
logLevel the Log.LogLevel
format A format string for the message to log
args The format string arguments

public static void setGlobalConfigInstance (IGlobalConfiguration globalConfig)

Sets the GlobalConfiguration instance for CLog to use - exposed for unit testing

Parameters
globalConfig the GlobalConfiguration object for CLog to use

public static void v (String format, Object... args)

The shim version of v(String, String). Also calls String.format for convenience.

Parameters
format A format string for the message to log
args The format string arguments

public static void v (String message)

The shim version of v(String, String).

Parameters
message The String to log

public static void w (String message)

The shim version of w(String, String).

Parameters
message The String to log

public static void w (String format, Object... args)

The shim version of w(String, String). Also calls String.format for convenience.

Parameters
format A format string for the message to log
args The format string arguments

public static void wtf (String message, Throwable t)

What a Terrible Failure: Report a condition that should never happen. The error will always be logged at level ASSERT with the call stack.

Parameters
message The message you would like logged.
t (Optional) An exception to log. If null, only message will be logged.

public static void wtf (Throwable t)

What a Terrible Failure: Report a condition that should never happen. The error will always be logged at level ASSERT with the call stack.

Parameters
t (Optional) An exception to log. If null, only message will be logged.

public static void wtf (String format, Object... args)

What a Terrible Failure: Report a condition that should never happen. The error will always be logged at level ASSERT with the call stack. Also calls String.format for convenience.

Parameters
format A format string for the message to log
args The format string arguments

public static void wtf (String message)

What a Terrible Failure: Report a condition that should never happen. The error will always be logged at level ASSERT with the call stack.

Parameters
message The message you would like logged.