Package android.util
Class Log
- java.lang.Object
-
- android.util.Log
-
public final class Log extends java.lang.Object
Mock Log implementation that writes to the console when testing on non android host.
-
-
Field Summary
Fields Modifier and Type Field Description static int
ASSERT
Priority constant for the println method.static int
DEBUG
Priority constant for the println method; use Log.d.static int
ERROR
Priority constant for the println method; use Log.e.static int
INFO
Priority constant for the println method; use Log.i.static int
LOG_ID_CRASH
static int
LOG_ID_EVENTS
static int
LOG_ID_MAIN
static int
LOG_ID_RADIO
static int
LOG_ID_SYSTEM
static int
VERBOSE
Priority constant for the println method; use Log.v.static int
WARN
Priority constant for the println method; use Log.w.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
d(java.lang.String tag, java.lang.String msg)
Send aDEBUG
log message.static int
d(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr)
Send aDEBUG
log message and log the exception.static int
e(java.lang.String tag, java.lang.String msg)
Send anERROR
log message.static int
e(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr)
Send aERROR
log message and log the exception.static java.lang.String
getStackTraceString(java.lang.Throwable tr)
Handy function to get a loggable stack trace from a Throwablestatic int
i(java.lang.String tag, java.lang.String msg)
Send anINFO
log message.static int
i(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr)
Send aINFO
log message and log the exception.static boolean
isLoggable(java.lang.String tag, int level)
Checks to see whether or not a log for the specified tag is loggable at the specified level.static int
println(int bufID, int priority, java.lang.String tag, java.lang.String msg)
Print log message to the console.static int
println(int priority, java.lang.String tag, java.lang.String msg)
Low-level logging call.static int
v(java.lang.String tag, java.lang.String msg)
Send aVERBOSE
log message.static int
v(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr)
Send aVERBOSE
log message and log the exception.static int
w(java.lang.String tag, java.lang.String msg)
Send aWARN
log message.static int
w(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr)
Send aWARN
log message and log the exception.static int
w(java.lang.String tag, java.lang.Throwable tr)
Send aWARN
log message and log the exception.
-
-
-
Field Detail
-
VERBOSE
public static final int VERBOSE
Priority constant for the println method; use Log.v.- See Also:
- Constant Field Values
-
DEBUG
public static final int DEBUG
Priority constant for the println method; use Log.d.- See Also:
- Constant Field Values
-
INFO
public static final int INFO
Priority constant for the println method; use Log.i.- See Also:
- Constant Field Values
-
WARN
public static final int WARN
Priority constant for the println method; use Log.w.- See Also:
- Constant Field Values
-
ERROR
public static final int ERROR
Priority constant for the println method; use Log.e.- See Also:
- Constant Field Values
-
ASSERT
public static final int ASSERT
Priority constant for the println method.- See Also:
- Constant Field Values
-
LOG_ID_MAIN
public static final int LOG_ID_MAIN
- See Also:
- Constant Field Values
-
LOG_ID_RADIO
public static final int LOG_ID_RADIO
- See Also:
- Constant Field Values
-
LOG_ID_EVENTS
public static final int LOG_ID_EVENTS
- See Also:
- Constant Field Values
-
LOG_ID_SYSTEM
public static final int LOG_ID_SYSTEM
- See Also:
- Constant Field Values
-
LOG_ID_CRASH
public static final int LOG_ID_CRASH
- See Also:
- Constant Field Values
-
-
Method Detail
-
isLoggable
public static boolean isLoggable(java.lang.String tag, int level)
Checks to see whether or not a log for the specified tag is loggable at the specified level. This method always return true since the Log type is used for mocking.- Parameters:
tag
- The tag to check. This value may be null.level
- The level to check.- Returns:
- true
-
v
public static int v(java.lang.String tag, java.lang.String msg)
Send aVERBOSE
log message.- Parameters:
tag
- Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.msg
- The message you would like logged.- Returns:
- returns 0.
-
v
public static int v(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr)
Send aVERBOSE
log message and log the exception.- Parameters:
tag
- Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.msg
- The message you would like logged.tr
- An exception to log- Returns:
- returns 0.
-
d
public static int d(java.lang.String tag, java.lang.String msg)
Send aDEBUG
log message.- Parameters:
tag
- Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.msg
- The message you would like logged.- Returns:
- returns 0.
-
d
public static int d(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr)
Send aDEBUG
log message and log the exception.- Parameters:
tag
- Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.msg
- The message you would like logged.tr
- An exception to log.- Returns:
- returns 0.
-
i
public static int i(java.lang.String tag, java.lang.String msg)
Send anINFO
log message.- Parameters:
tag
- Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.msg
- The message you would like logged.- Returns:
- returns 0.
-
i
public static int i(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr)
Send aINFO
log message and log the exception.- Parameters:
tag
- Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.msg
- The message you would like logged.tr
- An exception to log.- Returns:
- returns 0.
-
w
public static int w(java.lang.String tag, java.lang.String msg)
Send aWARN
log message.- Parameters:
tag
- Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.msg
- The message you would like logged.- Returns:
- returns 0.
-
w
public static int w(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr)
Send aWARN
log message and log the exception.- Parameters:
tag
- Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.msg
- The message you would like logged.tr
- An exception to log.- Returns:
- returns 0.
-
w
public static int w(java.lang.String tag, java.lang.Throwable tr)
Send aWARN
log message and log the exception.- Parameters:
tag
- Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.tr
- An exception to log.- Returns:
- returns 0.
-
e
public static int e(java.lang.String tag, java.lang.String msg)
Send anERROR
log message.- Parameters:
tag
- Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.msg
- The message you would like logged.- Returns:
- returns 0.
-
e
public static int e(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr)
Send aERROR
log message and log the exception.- Parameters:
tag
- Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.msg
- The message you would like logged.tr
- An exception to log.- Returns:
- returns 0.
-
getStackTraceString
public static java.lang.String getStackTraceString(java.lang.Throwable tr)
Handy function to get a loggable stack trace from a Throwable- Parameters:
tr
- An exception to log.- Returns:
- The stack trace.
-
println
public static int println(int priority, java.lang.String tag, java.lang.String msg)
Low-level logging call.- Parameters:
priority
- The priority/type of this log messagetag
- Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.msg
- The message you would like logged.- Returns:
- The number of bytes written.
-
println
public static int println(int bufID, int priority, java.lang.String tag, java.lang.String msg)
Print log message to the console.- Parameters:
bufID
- The buffer id.priority
- The priority of the log entry.tag
- The tag.msg
- The log message- Returns:
- returns 0.
-
-