diff options
author | Guang Zhu <guangzhu@google.com> | 2014-09-07 21:51:03 -0700 |
---|---|---|
committer | Guang Zhu <guangzhu@google.com> | 2014-09-08 23:31:43 -0700 |
commit | 7a310443616941f6b1899e902a43f4e93d66f584 (patch) | |
tree | c68fd3bce56bbb4006acf11a2cfea6606d491273 | |
parent | 1613227a1f60d88daf2d63907a3c289520cb5b52 (diff) | |
download | tradefederation-7a310443616941f6b1899e902a43f4e93d66f584.tar.gz |
allo specifying custom logcat command in LogcatReceiver
Change-Id: I25835440176e30a9eea318f98be8e113e28e35a3
-rw-r--r-- | src/com/android/tradefed/device/LogcatReceiver.java | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/com/android/tradefed/device/LogcatReceiver.java b/src/com/android/tradefed/device/LogcatReceiver.java index 9736fdfbc..cd2d50287 100644 --- a/src/com/android/tradefed/device/LogcatReceiver.java +++ b/src/com/android/tradefed/device/LogcatReceiver.java @@ -28,15 +28,35 @@ public class LogcatReceiver { static final String LOGCAT_CMD = "logcat -v threadtime"; private static final String LOGCAT_DESC = "logcat"; - public LogcatReceiver(ITestDevice device, long maxFileSize, int logStartDelay) { + /** + * Creates an instance with any specified logcat command + * @param device the device to start logcat on + * @param logcatCmd the logcat command to run (including 'logcat' part), see details on + * available options in logcat help message + * @param maxFileSize maximum file size, earlier lines will be discarded once size is reached + * @param logStartDelay the delay to wait after the device becomes online + */ + public LogcatReceiver(ITestDevice device, String logcatCmd, + long maxFileSize, int logStartDelay) { + mReceiver = new LargeOutputReceiver(LOGCAT_DESC, device.getSerialNumber(), maxFileSize); // FIXME: remove mLogStartDelay. Currently delay starting logcat, as starting // immediately after a device comes online has caused adb instability - mDeviceAction = new BackgroundDeviceAction(LOGCAT_CMD, LOGCAT_DESC, device, + mDeviceAction = new BackgroundDeviceAction(logcatCmd, LOGCAT_DESC, device, mReceiver, logStartDelay); } + /** + * Creates an instance with default logcat 'threadtime' format + * @param device the device to start logcat on + * @param maxFileSize maximum file size, earlier lines will be discarded once size is reached + * @param logStartDelay the delay to wait after the device becomes online + */ + public LogcatReceiver(ITestDevice device, long maxFileSize, int logStartDelay) { + this(device, LOGCAT_CMD, maxFileSize, logStartDelay); + } + public void start() { mDeviceAction.start(); } |