[flutter_tool] Don't truncate verbose logs from _flutter.listViews (#34255)

This commit is contained in:
Zachary Anderson
2019-06-12 11:18:53 -07:00
committed by GitHub
parent 75b5ceccd9
commit 22ca3f96ca
2 changed files with 9 additions and 2 deletions

View File

@@ -843,12 +843,15 @@ class VM extends ServiceObjectOwner {
Future<Map<String, dynamic>> invokeRpcRaw(
String method, {
Map<String, dynamic> params = const <String, dynamic>{},
bool truncateLogs = true,
}) async {
printTrace('Sending to VM service: $method($params)');
assert(params != null);
try {
final Map<String, dynamic> result = await _vmService._sendRequest(method, params);
printTrace('Result: ${_truncate(result.toString(), 250, '...')}');
final String resultString =
truncateLogs ? _truncate(result.toString(), 250, '...') : result.toString();
printTrace('Result: $resultString');
return result;
} on WebSocketChannelException catch (error) {
throwToolExit('Error connecting to observatory: $error');
@@ -864,10 +867,12 @@ class VM extends ServiceObjectOwner {
Future<T> invokeRpc<T extends ServiceObject>(
String method, {
Map<String, dynamic> params = const <String, dynamic>{},
bool truncateLogs = true,
}) async {
final Map<String, dynamic> response = await invokeRpcRaw(
method,
params: params,
truncateLogs: truncateLogs,
);
final ServiceObject serviceObject = ServiceObject._fromMap(this, response);
if ((serviceObject != null) && (serviceObject._canCache)) {
@@ -971,7 +976,8 @@ class VM extends ServiceObjectOwner {
// When the future returned by invokeRpc() below returns,
// the _viewCache will have been updated.
// This message updates all the views of every isolate.
await vmService.vm.invokeRpc<ServiceObject>('_flutter.listViews');
await vmService.vm.invokeRpc<ServiceObject>(
'_flutter.listViews', truncateLogs: false);
if (_viewCache.values.isNotEmpty || !waitForViews)
return;
failCount += 1;

View File

@@ -250,6 +250,7 @@ class MockVM implements VM {
Map<String, dynamic> params = const <String, dynamic>{},
Duration timeout,
bool timeoutFatal = true,
bool truncateLogs = true,
}) async {
_service.messages.add('$method $params');
return <String, dynamic>{'success': true};