mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
Teach flutter logs to show only new logs
After this patch, the flutter logs command on Android shows only log messages since the command was run. Previously, it showed historical logs, which was confusing. Fixes #2013
This commit is contained in:
parent
ed34507369
commit
ad718a8d1e
@ -297,7 +297,7 @@ class AndroidDevice extends Device {
|
|||||||
|
|
||||||
// Return the most recent timestamp in the Android log. The format can be
|
// Return the most recent timestamp in the Android log. The format can be
|
||||||
// passed to logcat's -T option.
|
// passed to logcat's -T option.
|
||||||
String lastLogcatTimestamp() {
|
String get lastLogcatTimestamp {
|
||||||
String output = runCheckedSync(adbCommandForDevice(<String>[
|
String output = runCheckedSync(adbCommandForDevice(<String>[
|
||||||
'-s', id, 'logcat', '-v', 'time', '-t', '1'
|
'-s', id, 'logcat', '-v', 'time', '-t', '1'
|
||||||
]));
|
]));
|
||||||
@ -310,7 +310,7 @@ class AndroidDevice extends Device {
|
|||||||
Future<String> stopTracing(AndroidApk apk, { String outPath }) async {
|
Future<String> stopTracing(AndroidApk apk, { String outPath }) async {
|
||||||
// Workaround for logcat -c not always working:
|
// Workaround for logcat -c not always working:
|
||||||
// http://stackoverflow.com/questions/25645012/logcat-on-android-l-not-clearing-after-unplugging-and-reconnecting
|
// http://stackoverflow.com/questions/25645012/logcat-on-android-l-not-clearing-after-unplugging-and-reconnecting
|
||||||
String beforeStop = lastLogcatTimestamp();
|
String beforeStop = lastLogcatTimestamp;
|
||||||
runCheckedSync(adbCommandForDevice(<String>[
|
runCheckedSync(adbCommandForDevice(<String>[
|
||||||
'shell',
|
'shell',
|
||||||
'am',
|
'am',
|
||||||
@ -472,6 +472,8 @@ class _AdbLogReader extends DeviceLogReader {
|
|||||||
'logcat',
|
'logcat',
|
||||||
'-v',
|
'-v',
|
||||||
'tag', // Only log the tag and the message
|
'tag', // Only log the tag and the message
|
||||||
|
'-T',
|
||||||
|
device.lastLogcatTimestamp,
|
||||||
'-s',
|
'-s',
|
||||||
'flutter:V',
|
'flutter:V',
|
||||||
'ActivityManager:W',
|
'ActivityManager:W',
|
||||||
|
Loading…
Reference in New Issue
Block a user