FileDocCategorySizeDatePackage
LocalLog.javaAPI DocAndroid 5.1 API1767Thu Mar 12 22:22:10 GMT 2015android.util

LocalLog

public final class LocalLog extends Object
hide

Fields Summary
private LinkedList
mLog
private int
mMaxLines
private long
mNow
Constructors Summary
public LocalLog(int maxLines)

        mLog = new LinkedList<String>();
        mMaxLines = maxLines;
    
Methods Summary
public synchronized voiddump(java.io.FileDescriptor fd, java.io.PrintWriter pw, java.lang.String[] args)

        Iterator<String> itr = mLog.listIterator(0);
        while (itr.hasNext()) {
            pw.println(itr.next());
        }
    
public synchronized voidlog(java.lang.String msg)

        if (mMaxLines > 0) {
            mNow = System.currentTimeMillis();
            StringBuilder sb = new StringBuilder();
            Calendar c = Calendar.getInstance();
            c.setTimeInMillis(mNow);
            sb.append(String.format("%tm-%td %tH:%tM:%tS.%tL", c, c, c, c, c, c));
            mLog.add(sb.toString() + " - " + msg);
            while (mLog.size() > mMaxLines) mLog.remove();
        }