Logpublic final class Log extends Object Mock Log implementation for testing on non android host. |
Fields Summary |
---|
public static final int | VERBOSEPriority constant for the println method; use Log.v. | public static final int | DEBUGPriority constant for the println method; use Log.d. | public static final int | INFOPriority constant for the println method; use Log.i. | public static final int | WARNPriority constant for the println method; use Log.w. | public static final int | ERRORPriority constant for the println method; use Log.e. | public static final int | ASSERTPriority constant for the println method. | public static final int | LOG_ID_MAIN | public static final int | LOG_ID_RADIO | public static final int | LOG_ID_EVENTS | public static final int | LOG_ID_SYSTEM | public static final int | LOG_ID_CRASH |
Constructors Summary |
---|
private Log()
|
Methods Summary |
---|
public static int | d(java.lang.String tag, java.lang.String msg)Send a {@link #DEBUG} log message.
return println(LOG_ID_MAIN, DEBUG, tag, msg);
| public static int | d(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr)Send a {@link #DEBUG} log message and log the exception.
return println(LOG_ID_MAIN, DEBUG, tag, msg + '\n" + getStackTraceString(tr));
| public static int | e(java.lang.String tag, java.lang.String msg)Send an {@link #ERROR} log message.
return println(LOG_ID_MAIN, ERROR, tag, msg);
| public static int | e(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr)Send a {@link #ERROR} log message and log the exception.
return println(LOG_ID_MAIN, ERROR, tag, msg + '\n" + getStackTraceString(tr));
| public static java.lang.String | getStackTraceString(java.lang.Throwable tr)Handy function to get a loggable stack trace from a Throwable
if (tr == null) {
return "";
}
// This is to reduce the amount of log spew that apps do in the non-error
// condition of the network being unavailable.
Throwable t = tr;
while (t != null) {
if (t instanceof UnknownHostException) {
return "";
}
t = t.getCause();
}
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
tr.printStackTrace(pw);
pw.flush();
return sw.toString();
| public static int | i(java.lang.String tag, java.lang.String msg)Send an {@link #INFO} log message.
return println(LOG_ID_MAIN, INFO, tag, msg);
| public static int | i(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr)Send a {@link #INFO} log message and log the exception.
return println(LOG_ID_MAIN, INFO, tag, msg + '\n" + getStackTraceString(tr));
| public static int | println(int priority, java.lang.String tag, java.lang.String msg)Low-level logging call.
return println(LOG_ID_MAIN, priority, tag, msg);
| public static int | println(int bufID, int priority, java.lang.String tag, java.lang.String msg)
return 0;
| public static int | v(java.lang.String tag, java.lang.String msg)Send a {@link #VERBOSE} log message.
return println(LOG_ID_MAIN, VERBOSE, tag, msg);
| public static int | v(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr)Send a {@link #VERBOSE} log message and log the exception.
return println(LOG_ID_MAIN, VERBOSE, tag, msg + '\n" + getStackTraceString(tr));
| public static int | w(java.lang.String tag, java.lang.Throwable tr)
return println(LOG_ID_MAIN, WARN, tag, getStackTraceString(tr));
| public static int | w(java.lang.String tag, java.lang.String msg)Send a {@link #WARN} log message.
return println(LOG_ID_MAIN, WARN, tag, msg);
| public static int | w(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr)Send a {@link #WARN} log message and log the exception.
return println(LOG_ID_MAIN, WARN, tag, msg + '\n" + getStackTraceString(tr));
|
|