FileDocCategorySizeDatePackage
VolleyLog.javaAPI DocAndroid 5.1 API6196Thu Mar 12 22:22:56 GMT 2015com.android.volley

VolleyLog

public class VolleyLog extends Object
Logging helper class.

Fields Summary
public static String
TAG
public static boolean
DEBUG
Constructors Summary
Methods Summary
private static java.lang.StringbuildMessage(java.lang.String format, java.lang.Object args)
Formats the caller's provided message and prepends useful info like calling thread ID and method name.

        String msg = (args == null) ? format : String.format(Locale.US, format, args);
        StackTraceElement[] trace = new Throwable().fillInStackTrace().getStackTrace();

        String caller = "<unknown>";
        // Walk up the stack looking for the first caller outside of VolleyLog.
        // It will be at least two frames up, so start there.
        for (int i = 2; i < trace.length; i++) {
            Class<?> clazz = trace[i].getClass();
            if (!clazz.equals(VolleyLog.class)) {
                String callingClass = trace[i].getClassName();
                callingClass = callingClass.substring(callingClass.lastIndexOf('.") + 1);
                callingClass = callingClass.substring(callingClass.lastIndexOf('$") + 1);

                caller = callingClass + "." + trace[i].getMethodName();
                break;
            }
        }
        return String.format(Locale.US, "[%d] %s: %s",
                Thread.currentThread().getId(), caller, msg);
    
public static voidd(java.lang.String format, java.lang.Object args)

        Log.d(TAG, buildMessage(format, args));
    
public static voide(java.lang.String format, java.lang.Object args)

        Log.e(TAG, buildMessage(format, args));
    
public static voide(java.lang.Throwable tr, java.lang.String format, java.lang.Object args)

        Log.e(TAG, buildMessage(format, args), tr);
    
public static voidsetTag(java.lang.String tag)
Customize the log tag for your application, so that other apps using Volley don't mix their logs with yours.
Enable the log property for your tag before starting your app:
{@code adb shell setprop log.tag.<tag>}


                                                
         
        d("Changing log tag to %s", tag);
        TAG = tag;

        // Reinitialize the DEBUG "constant"
        DEBUG = Log.isLoggable(TAG, Log.VERBOSE);
    
public static voidv(java.lang.String format, java.lang.Object args)

        if (DEBUG) {
            Log.v(TAG, buildMessage(format, args));
        }
    
public static voidwtf(java.lang.String format, java.lang.Object args)

        Log.wtf(TAG, buildMessage(format, args));
    
public static voidwtf(java.lang.Throwable tr, java.lang.String format, java.lang.Object args)

        Log.wtf(TAG, buildMessage(format, args), tr);