add identifiers to progress messages (#6868)
diff --git a/packages/flutter_tools/lib/src/base/logger.dart b/packages/flutter_tools/lib/src/base/logger.dart
index 02cc1e6..c86f064 100644
--- a/packages/flutter_tools/lib/src/base/logger.dart
+++ b/packages/flutter_tools/lib/src/base/logger.dart
@@ -33,7 +33,10 @@
void printTrace(String message);
/// Start an indeterminate progress display.
- Status startProgress(String message);
+ ///
+ /// [message] is the message to display to the user; [progressId] provides an ID which can be
+ /// used to identify this type of progress (`hot.reload`, `hot.restart`, ...).
+ Status startProgress(String message, { String progressId });
}
class Status {
@@ -76,7 +79,7 @@
void printTrace(String message) { }
@override
- Status startProgress(String message) {
+ Status startProgress(String message, { String progressId }) {
if (_status != null) {
// Ignore nested progresses; return a no-op status object.
return new Status();
@@ -119,7 +122,7 @@
void printTrace(String message) => _trace.writeln(message);
@override
- Status startProgress(String message) {
+ Status startProgress(String message, { String progressId }) {
printStatus(message);
return new Status();
}
@@ -151,7 +154,7 @@
}
@override
- Status startProgress(String message) {
+ Status startProgress(String message, { String progressId }) {
printStatus(message);
return new Status();
}
diff --git a/packages/flutter_tools/lib/src/commands/daemon.dart b/packages/flutter_tools/lib/src/commands/daemon.dart
index e44e17e..e9dc937 100644
--- a/packages/flutter_tools/lib/src/commands/daemon.dart
+++ b/packages/flutter_tools/lib/src/commands/daemon.dart
@@ -637,7 +637,7 @@
}
@override
- Status startProgress(String message) {
+ Status startProgress(String message, { String progressId }) {
printStatus(message);
return new Status();
}
@@ -711,7 +711,7 @@
Status _status;
@override
- Status startProgress(String message) {
+ Status startProgress(String message, { String progressId }) {
// Ignore nested progresses; return a no-op status object.
if (_status != null)
return new Status();
@@ -720,10 +720,11 @@
_sendProgressEvent(<String, dynamic>{
'id': id.toString(),
+ 'progressId': progressId,
'message': message,
});
- _status = new _AppLoggerStatus(this, id);
+ _status = new _AppLoggerStatus(this, id, progressId);
return _status;
}
@@ -747,10 +748,11 @@
}
class _AppLoggerStatus implements Status {
- _AppLoggerStatus(this.logger, this.id);
+ _AppLoggerStatus(this.logger, this.id, this.progressId);
final _AppRunLogger logger;
final int id;
+ final String progressId;
@override
void stop({ bool showElapsedTime: true }) {
@@ -767,6 +769,7 @@
void _sendFinished() {
logger._sendProgressEvent(<String, dynamic>{
'id': id.toString(),
+ 'progressId': progressId,
'finished': true
});
}
diff --git a/packages/flutter_tools/lib/src/hot.dart b/packages/flutter_tools/lib/src/hot.dart
index d2753d7..592a6e1 100644
--- a/packages/flutter_tools/lib/src/hot.dart
+++ b/packages/flutter_tools/lib/src/hot.dart
@@ -468,7 +468,7 @@
@override
Future<OperationResult> restart({ bool fullRestart: false, bool pauseAfterRestart: false }) async {
if (fullRestart) {
- Status status = logger.startProgress('Performing full restart...');
+ Status status = logger.startProgress('Performing full restart...', progressId: 'hot.restart');
try {
await _restartFromSources();
status.stop();
@@ -479,7 +479,7 @@
rethrow;
}
} else {
- Status status = logger.startProgress('Performing hot reload...');
+ Status status = logger.startProgress('Performing hot reload...', progressId: 'hot.reload');
try {
OperationResult result = await _reloadSources(pause: pauseAfterRestart);
status.stop();