Unverified Commit 22ca3f96 authored by Zachary Anderson's avatar Zachary Anderson Committed by GitHub

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

parent 75b5cecc
...@@ -843,12 +843,15 @@ class VM extends ServiceObjectOwner { ...@@ -843,12 +843,15 @@ class VM extends ServiceObjectOwner {
Future<Map<String, dynamic>> invokeRpcRaw( Future<Map<String, dynamic>> invokeRpcRaw(
String method, { String method, {
Map<String, dynamic> params = const <String, dynamic>{}, Map<String, dynamic> params = const <String, dynamic>{},
bool truncateLogs = true,
}) async { }) async {
printTrace('Sending to VM service: $method($params)'); printTrace('Sending to VM service: $method($params)');
assert(params != null); assert(params != null);
try { try {
final Map<String, dynamic> result = await _vmService._sendRequest(method, params); 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; return result;
} on WebSocketChannelException catch (error) { } on WebSocketChannelException catch (error) {
throwToolExit('Error connecting to observatory: $error'); throwToolExit('Error connecting to observatory: $error');
...@@ -864,10 +867,12 @@ class VM extends ServiceObjectOwner { ...@@ -864,10 +867,12 @@ class VM extends ServiceObjectOwner {
Future<T> invokeRpc<T extends ServiceObject>( Future<T> invokeRpc<T extends ServiceObject>(
String method, { String method, {
Map<String, dynamic> params = const <String, dynamic>{}, Map<String, dynamic> params = const <String, dynamic>{},
bool truncateLogs = true,
}) async { }) async {
final Map<String, dynamic> response = await invokeRpcRaw( final Map<String, dynamic> response = await invokeRpcRaw(
method, method,
params: params, params: params,
truncateLogs: truncateLogs,
); );
final ServiceObject serviceObject = ServiceObject._fromMap(this, response); final ServiceObject serviceObject = ServiceObject._fromMap(this, response);
if ((serviceObject != null) && (serviceObject._canCache)) { if ((serviceObject != null) && (serviceObject._canCache)) {
...@@ -971,7 +976,8 @@ class VM extends ServiceObjectOwner { ...@@ -971,7 +976,8 @@ class VM extends ServiceObjectOwner {
// When the future returned by invokeRpc() below returns, // When the future returned by invokeRpc() below returns,
// the _viewCache will have been updated. // the _viewCache will have been updated.
// This message updates all the views of every isolate. // 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) if (_viewCache.values.isNotEmpty || !waitForViews)
return; return;
failCount += 1; failCount += 1;
......
...@@ -250,6 +250,7 @@ class MockVM implements VM { ...@@ -250,6 +250,7 @@ class MockVM implements VM {
Map<String, dynamic> params = const <String, dynamic>{}, Map<String, dynamic> params = const <String, dynamic>{},
Duration timeout, Duration timeout,
bool timeoutFatal = true, bool timeoutFatal = true,
bool truncateLogs = true,
}) async { }) async {
_service.messages.add('$method $params'); _service.messages.add('$method $params');
return <String, dynamic>{'success': true}; return <String, dynamic>{'success': true};
......
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