Code example for PrintWriter

Methods: printf

0
            mOut = new PrintWriter(file);
            mDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US);
        } 
 
        public void log(String message) {
            mOut.printf("%s %s\n", mDateFormat.format(new Date()), message);
        } 
 
        public void close() { 
            mOut.close();
        } 
    } 
 
    private class LogcatSink implements TracerSink { 
 
        private static final String LOGCAT_TAG = "UiAutomatorTrace";
 
        public void log(String message) {
            Log.i(LOGCAT_TAG, message);
        }