Commit ad7fd3e4 authored by Devon Carew's avatar Devon Carew

Merge pull request #2527 from devoncarew/fix_logs

fix a regression in flutter logs
parents 335354d9 2e9fef8c
...@@ -102,7 +102,7 @@ class AndroidDevice extends Device { ...@@ -102,7 +102,7 @@ class AndroidDevice extends Device {
// output lines like this, which we want to ignore: // output lines like this, which we want to ignore:
// adb server is out of date. killing.. // adb server is out of date. killing..
// * daemon started successfully * // * daemon started successfully *
runCheckedSync(adbCommandForDevice(<String>['start-server'])); runCheckedSync(<String>[androidSdk.adbPath, 'start-server']);
// Sample output: '22' // Sample output: '22'
String sdkVersion = runCheckedSync( String sdkVersion = runCheckedSync(
...@@ -283,7 +283,7 @@ class AndroidDevice extends Device { ...@@ -283,7 +283,7 @@ class AndroidDevice extends Device {
TargetPlatform get platform => TargetPlatform.android; TargetPlatform get platform => TargetPlatform.android;
void clearLogs() { void clearLogs() {
runSync(adbCommandForDevice(<String>['-s', id, 'logcat', '-c'])); runSync(adbCommandForDevice(<String>['logcat', '-c']));
} }
DeviceLogReader get logReader { DeviceLogReader get logReader {
...@@ -306,7 +306,7 @@ class AndroidDevice extends Device { ...@@ -306,7 +306,7 @@ class AndroidDevice extends Device {
/// no available timestamp. The format can be passed to logcat's -T option. /// no available timestamp. The format can be passed to logcat's -T option.
String get lastLogcatTimestamp { String get lastLogcatTimestamp {
String output = runCheckedSync(adbCommandForDevice(<String>[ String output = runCheckedSync(adbCommandForDevice(<String>[
'-s', id, 'logcat', '-v', 'time', '-t', '1' 'logcat', '-v', 'time', '-t', '1'
])); ]));
RegExp timeRegExp = new RegExp(r'^\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3}', multiLine: true); RegExp timeRegExp = new RegExp(r'^\d{2}-\d{2} \d{2}:\d{2}:\d{2}\.\d{3}', multiLine: true);
...@@ -332,7 +332,7 @@ class AndroidDevice extends Device { ...@@ -332,7 +332,7 @@ class AndroidDevice extends Device {
String tracePath = null; String tracePath = null;
bool isComplete = false; bool isComplete = false;
while (!isComplete) { while (!isComplete) {
List<String> args = <String>['-s', id, 'logcat', '-d']; List<String> args = <String>['logcat', '-d'];
if (beforeStop != null) if (beforeStop != null)
args.addAll(<String>['-T', beforeStop]); args.addAll(<String>['-T', beforeStop]);
String logs = runCheckedSync(adbCommandForDevice(args)); String logs = runCheckedSync(adbCommandForDevice(args));
...@@ -488,21 +488,11 @@ class _AdbLogReader extends DeviceLogReader { ...@@ -488,21 +488,11 @@ class _AdbLogReader extends DeviceLogReader {
throw new StateError('_AdbLogReader must be stopped before it can be started.'); throw new StateError('_AdbLogReader must be stopped before it can be started.');
// Start the adb logcat process. // Start the adb logcat process.
List<String> args = <String>[ List<String> args = <String>['logcat', '-v', 'tag'];
'-s',
device.id,
'logcat',
'-v',
'tag', // Only log the tag and the message
'-s',
'flutter:V',
'ActivityManager:W',
'System.err:W',
'*:F'
];
String lastTimestamp = device.lastLogcatTimestamp; String lastTimestamp = device.lastLogcatTimestamp;
if (lastTimestamp != null) if (lastTimestamp != null)
args.addAll(<String>['-T', lastTimestamp]); args.addAll(<String>['-T', lastTimestamp]);
args.addAll(<String>['-s', 'flutter:V', 'ActivityManager:W', 'System.err:W', '*:F']);
_process = await runCommand(device.adbCommandForDevice(args)); _process = await runCommand(device.adbCommandForDevice(args));
_stdoutSubscription = _stdoutSubscription =
_process.stdout.transform(UTF8.decoder) _process.stdout.transform(UTF8.decoder)
......
...@@ -55,9 +55,9 @@ class LogsCommand extends FlutterCommand { ...@@ -55,9 +55,9 @@ class LogsCommand extends FlutterCommand {
StreamSubscription subscription = reader.lines.listen((String line) { StreamSubscription subscription = reader.lines.listen((String line) {
if (devices.length > 1) { if (devices.length > 1) {
// Prefix with the name of the device. // Prefix with the name of the device.
print('[${reader.name}] $line'); printStatus('[${reader.name}] $line');
} else { } else {
print(line); printStatus(line);
} }
}); });
// Wait for the log reader to be finished. // Wait for the log reader to be finished.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment