Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(494)

Unified Diff: sdk/lib/_internal/pub/lib/src/http.dart

Issue 15174005: Add a bunch of extra logging to Pub. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: error fixes Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/pub/lib/src/http.dart
diff --git a/sdk/lib/_internal/pub/lib/src/http.dart b/sdk/lib/_internal/pub/lib/src/http.dart
index eecfda3fcdd86b5435fde55a418df65aa1688e6c..2bb43e26931a25384f18329a19b416072fb7eaaf 100644
--- a/sdk/lib/_internal/pub/lib/src/http.dart
+++ b/sdk/lib/_internal/pub/lib/src/http.dart
@@ -31,6 +31,8 @@ bool _initializedSecureSocket = false;
/// An HTTP client that transforms 40* errors and socket exceptions into more
/// user-friendly error messages.
class PubHttpClient extends http.BaseClient {
+ final _requestStopwatches = new Map<http.BaseRequest, Stopwatch>();
+
http.Client inner;
PubHttpClient([http.Client inner])
@@ -41,6 +43,7 @@ class PubHttpClient extends http.BaseClient {
}
Future<http.StreamedResponse> send(http.BaseRequest request) {
+ _requestStopwatches[request] = new Stopwatch()..start();
_logRequest(request);
// TODO(nweiz): remove this when issue 4061 is fixed.
@@ -128,8 +131,10 @@ class PubHttpClient extends http.BaseClient {
var responseLog = new StringBuffer();
var request = response.request;
+ var stopwatch = _requestStopwatches.remove(request)..stop();
responseLog.writeln("HTTP response ${response.statusCode} "
"${response.reasonPhrase} for ${request.method} ${request.url}");
+ responseLog.write("took ${stopwatch.elapsed}");
response.headers.forEach((name, value) =>
responseLog.writeln(_logField(name, value)));
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/hosted_source.dart ('k') | sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698