FileDocCategorySizeDatePackage
Log.javaAPI DocAndroid 5.1 API7896Thu Mar 12 22:22:48 GMT 2015android.util

Log

public final class Log extends Object
Mock Log implementation for testing on non android host.

Fields Summary
public static final int
VERBOSE
Priority constant for the println method; use Log.v.
public static final int
DEBUG
Priority constant for the println method; use Log.d.
public static final int
INFO
Priority constant for the println method; use Log.i.
public static final int
WARN
Priority constant for the println method; use Log.w.
public static final int
ERROR
Priority constant for the println method; use Log.e.
public static final int
ASSERT
Priority 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 intd(java.lang.String tag, java.lang.String msg)
Send a {@link #DEBUG} log message.

param
tag Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
param
msg The message you would like logged.

        return println(LOG_ID_MAIN, DEBUG, tag, msg);
    
public static intd(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr)
Send a {@link #DEBUG} log message and log the exception.

param
tag Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
param
msg The message you would like logged.
param
tr An exception to log

        return println(LOG_ID_MAIN, DEBUG, tag, msg + '\n" + getStackTraceString(tr));
    
public static inte(java.lang.String tag, java.lang.String msg)
Send an {@link #ERROR} log message.

param
tag Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
param
msg The message you would like logged.

        return println(LOG_ID_MAIN, ERROR, tag, msg);
    
public static inte(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr)
Send a {@link #ERROR} log message and log the exception.

param
tag Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
param
msg The message you would like logged.
param
tr An exception to log

        return println(LOG_ID_MAIN, ERROR, tag, msg + '\n" + getStackTraceString(tr));
    
public static java.lang.StringgetStackTraceString(java.lang.Throwable tr)
Handy function to get a loggable stack trace from a Throwable

param
tr An exception to log

        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 inti(java.lang.String tag, java.lang.String msg)
Send an {@link #INFO} log message.

param
tag Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
param
msg The message you would like logged.

        return println(LOG_ID_MAIN, INFO, tag, msg);
    
public static inti(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr)
Send a {@link #INFO} log message and log the exception.

param
tag Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
param
msg The message you would like logged.
param
tr An exception to log

        return println(LOG_ID_MAIN, INFO, tag, msg + '\n" + getStackTraceString(tr));
    
public static intprintln(int priority, java.lang.String tag, java.lang.String msg)
Low-level logging call.

param
priority The priority/type of this log message
param
tag Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
param
msg The message you would like logged.
return
The number of bytes written.

        return println(LOG_ID_MAIN, priority, tag, msg);
    
public static intprintln(int bufID, int priority, java.lang.String tag, java.lang.String msg)

hide

        return 0;
    
public static intv(java.lang.String tag, java.lang.String msg)
Send a {@link #VERBOSE} log message.

param
tag Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
param
msg The message you would like logged.

        return println(LOG_ID_MAIN, VERBOSE, tag, msg);
    
public static intv(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr)
Send a {@link #VERBOSE} log message and log the exception.

param
tag Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
param
msg The message you would like logged.
param
tr An exception to log

        return println(LOG_ID_MAIN, VERBOSE, tag, msg + '\n" + getStackTraceString(tr));
    
public static intw(java.lang.String tag, java.lang.Throwable tr)

        return println(LOG_ID_MAIN, WARN, tag, getStackTraceString(tr));
    
public static intw(java.lang.String tag, java.lang.String msg)
Send a {@link #WARN} log message.

param
tag Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
param
msg The message you would like logged.

        return println(LOG_ID_MAIN, WARN, tag, msg);
    
public static intw(java.lang.String tag, java.lang.String msg, java.lang.Throwable tr)
Send a {@link #WARN} log message and log the exception.

param
tag Used to identify the source of a log message. It usually identifies the class or activity where the log call occurs.
param
msg The message you would like logged.
param
tr An exception to log

        return println(LOG_ID_MAIN, WARN, tag, msg + '\n" + getStackTraceString(tr));