Merge "Make StubTest less chatty."
diff --git a/src/com/android/tradefed/result/TextResultReporter.java b/src/com/android/tradefed/result/TextResultReporter.java
index 0b13cf9..1bc221f 100644
--- a/src/com/android/tradefed/result/TextResultReporter.java
+++ b/src/com/android/tradefed/result/TextResultReporter.java
@@ -39,9 +39,12 @@
private static final String REPORT_DIR_NAME = "output-file-path";
@Option(name = REPORT_DIR_NAME, description =
- "root file system path to directory to store logs")
+ "root file system path to directory to store logs. Ignored if --save-logs is set.")
private File mReportDir = new File(System.getProperty("java.io.tmpdir"));
+ @Option(name = "save-logs", description = "save any logs to local disk.")
+ private boolean mSaveLogs = true;
+
/**
* Creates a {@link TextResultReporter}.
*/
@@ -98,14 +101,16 @@
*/
@Override
public void testLog(String dataName, LogDataType dataType, InputStreamSource dataStream) {
- try {
- File logFile = mLogFileSaver.saveLogData(dataName, dataType,
- dataStream.createInputStream());
- CLog.logAndDisplay(LogLevel.INFO, "Saved %s log to %s", dataName,
- logFile.getAbsolutePath());
- } catch (IOException e) {
- CLog.e("Failed to save log data");
- CLog.e(e);
+ if (mSaveLogs) {
+ try {
+ File logFile = mLogFileSaver.saveLogData(dataName, dataType,
+ dataStream.createInputStream());
+ CLog.logAndDisplay(LogLevel.INFO, "Saved %s log to %s", dataName,
+ logFile.getAbsolutePath());
+ } catch (IOException e) {
+ CLog.e("Failed to save log data");
+ CLog.e(e);
+ }
}
}
}