FileDocCategorySizeDatePackage
Log.javaAPI DocAndroid 5.1 API6441Thu Mar 12 22:22:42 GMT 2015android.telecom

Log

public final class Log extends Object
Manages logging for the entire module.
hide

Fields Summary
private static final String
TAG
public static final boolean
FORCE_LOGGING
public static final boolean
DEBUG
public static final boolean
INFO
public static final boolean
VERBOSE
public static final boolean
WARN
public static final boolean
ERROR
Constructors Summary
private Log()


      
Methods Summary
private static java.lang.StringbuildMessage(java.lang.String prefix, java.lang.String format, java.lang.Object args)

        String msg;
        try {
            msg = (args == null || args.length == 0) ? format
                    : String.format(Locale.US, format, args);
        } catch (IllegalFormatException ife) {
            wtf("Log", ife, "IllegalFormatException: formatString='%s' numArgs=%d", format,
                    args.length);
            msg = format + " (An error occurred while formatting the message.)";
        }
        return String.format(Locale.US, "%s: %s", prefix, msg);
    
public static voidd(java.lang.String prefix, java.lang.String format, java.lang.Object args)

        if (DEBUG) {
            android.util.Log.d(TAG, buildMessage(prefix, format, args));
        }
    
public static voidd(java.lang.Object objectPrefix, java.lang.String format, java.lang.Object args)

        if (DEBUG) {
            android.util.Log.d(TAG, buildMessage(getPrefixFromObject(objectPrefix), format, args));
        }
    
public static voide(java.lang.String prefix, java.lang.Throwable tr, java.lang.String format, java.lang.Object args)

        if (ERROR) {
            android.util.Log.e(TAG, buildMessage(prefix, format, args), tr);
        }
    
public static voide(java.lang.Object objectPrefix, java.lang.Throwable tr, java.lang.String format, java.lang.Object args)

        if (ERROR) {
            android.util.Log.e(TAG, buildMessage(getPrefixFromObject(objectPrefix), format, args),
                    tr);
        }
    
private static java.lang.StringencodeHex(byte[] bytes)

        StringBuffer hex = new StringBuffer(bytes.length * 2);

        for (int i = 0; i < bytes.length; i++) {
            int byteIntValue = bytes[i] & 0xff;
            if (byteIntValue < 0x10) {
                hex.append("0");
            }
            hex.append(Integer.toString(byteIntValue, 16));
        }

        return hex.toString();
    
private static java.lang.StringgetPrefixFromObject(java.lang.Object obj)

        return obj == null ? "<null>" : obj.getClass().getSimpleName();
    
public static voidi(java.lang.String prefix, java.lang.String format, java.lang.Object args)

        if (INFO) {
            android.util.Log.i(TAG, buildMessage(prefix, format, args));
        }
    
public static voidi(java.lang.Object objectPrefix, java.lang.String format, java.lang.Object args)

        if (INFO) {
            android.util.Log.i(TAG, buildMessage(getPrefixFromObject(objectPrefix), format, args));
        }
    
public static booleanisLoggable(int level)

        return FORCE_LOGGING || android.util.Log.isLoggable(TAG, level);
    
public static java.lang.Stringpii(java.lang.Object pii)
Redact personally identifiable information for production users. If we are running in verbose mode, return the original string, otherwise return a SHA-1 hash of the input string.

        if (pii == null || VERBOSE) {
            return String.valueOf(pii);
        }
        return "[" + secureHash(String.valueOf(pii).getBytes()) + "]";
    
private static java.lang.StringsecureHash(byte[] input)

        MessageDigest messageDigest;
        try {
            messageDigest = MessageDigest.getInstance("SHA-1");
        } catch (NoSuchAlgorithmException e) {
            return null;
        }
        messageDigest.update(input);
        byte[] result = messageDigest.digest();
        return encodeHex(result);
    
public static voidv(java.lang.String prefix, java.lang.String format, java.lang.Object args)

        if (VERBOSE) {
            android.util.Log.v(TAG, buildMessage(prefix, format, args));
        }
    
public static voidv(java.lang.Object objectPrefix, java.lang.String format, java.lang.Object args)

        if (VERBOSE) {
            android.util.Log.v(TAG, buildMessage(getPrefixFromObject(objectPrefix), format, args));
        }
    
public static voidw(java.lang.Object objectPrefix, java.lang.String format, java.lang.Object args)

        if (WARN) {
            android.util.Log.w(TAG, buildMessage(getPrefixFromObject(objectPrefix), format, args));
        }
    
public static voidw(java.lang.String prefix, java.lang.String format, java.lang.Object args)

        if (WARN) {
            android.util.Log.w(TAG, buildMessage(prefix, format, args));
        }
    
public static voidwtf(java.lang.String prefix, java.lang.Throwable tr, java.lang.String format, java.lang.Object args)

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

        android.util.Log.wtf(TAG, buildMessage(getPrefixFromObject(objectPrefix), format, args),
                tr);
    
public static voidwtf(java.lang.String prefix, java.lang.String format, java.lang.Object args)

        String msg = buildMessage(prefix, format, args);
        android.util.Log.wtf(TAG, msg, new IllegalStateException(msg));
    
public static voidwtf(java.lang.Object objectPrefix, java.lang.String format, java.lang.Object args)

        String msg = buildMessage(getPrefixFromObject(objectPrefix), format, args);
        android.util.Log.wtf(TAG, msg, new IllegalStateException(msg));