FileDocCategorySizeDatePackage
LocalLog.javaAPI DocAndroid 5.1 API1924Thu Mar 12 22:22:10 GMT 2015com.android.internal.util

LocalLog

public class LocalLog extends Object
Helper class for logging serious issues, which also keeps a small snapshot of the logged events that can be printed later, such as part of a system service's dumpsys output.
hide

Fields Summary
private final String
mTag
private final int
mMaxLines
private final ArrayList
mLines
Constructors Summary
public LocalLog(String tag)


       
        mTag = tag;
    
Methods Summary
public booleandump(java.io.PrintWriter pw, java.lang.String header, java.lang.String prefix)

        synchronized (mLines) {
            if (mLines.size() <= 0) {
                return false;
            }
            if (header != null) {
                pw.println(header);
            }
            for (int i=0; i<mLines.size(); i++) {
                if (prefix != null) {
                    pw.print(prefix);
                }
                pw.println(mLines.get(i));
            }
            return true;
        }
    
public voidw(java.lang.String msg)

        synchronized (mLines) {
            Slog.w(mTag, msg);
            if (mLines.size() >= mMaxLines) {
                mLines.remove(0);
            }
            mLines.add(msg);
        }