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

Unified Diff: pkg/shelf/lib/src/handlers/logger.dart

Issue 227563010: pkg/shelf: case-insensitive headers, cleaner Request ctor, a lot more tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fixing dependent code, changelog Created 6 years, 8 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
« no previous file with comments | « pkg/shelf/lib/shelf_io.dart ('k') | pkg/shelf/lib/src/message.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/shelf/lib/src/handlers/logger.dart
diff --git a/pkg/shelf/lib/src/handlers/logger.dart b/pkg/shelf/lib/src/handlers/logger.dart
index 1c1ce65f67cef3a03f9d47e63a8f6362bce4a121..2e95cf99268fec4f505e8414de26282f110a96c7 100644
--- a/pkg/shelf/lib/src/handlers/logger.dart
+++ b/pkg/shelf/lib/src/handlers/logger.dart
@@ -30,14 +30,14 @@ Middleware logRequests({void logger(String msg, bool isError)}) =>
var watch = new Stopwatch()..start();
return syncFuture(() => innerHandler(request)).then((response) {
- var msg = _getMessage(startTime, response.statusCode, request.pathInfo,
+ var msg = _getMessage(startTime, response.statusCode, request.url,
request.method, watch.elapsed);
logger(msg, false);
return response;
}, onError: (error, stackTrace) {
- var msg = _getErrorMessage(startTime, request.pathInfo, request.method,
+ var msg = _getErrorMessage(startTime, request.url, request.method,
watch.elapsed, error, stackTrace);
logger(msg, true);
@@ -47,13 +47,13 @@ Middleware logRequests({void logger(String msg, bool isError)}) =>
};
};
-String _getMessage(DateTime requestTime, int statusCode, String pathInfo,
+String _getMessage(DateTime requestTime, int statusCode, Uri url,
String method, Duration elapsedTime) {
- return '${requestTime}\t$elapsedTime\t$method\t[${statusCode}]\t${pathInfo}';
+ return '${requestTime}\t$elapsedTime\t$method\t[${statusCode}]\t${url}';
}
-String _getErrorMessage(DateTime requestTime, String pathInfo,
+String _getErrorMessage(DateTime requestTime, Uri url,
String method, Duration elapsedTime, Object error, StackTrace stack) {
var chain = new Chain.current();
@@ -63,7 +63,7 @@ String _getErrorMessage(DateTime requestTime, String pathInfo,
.terse;
}
- var msg = '${requestTime}\t$elapsedTime\t$method\t${pathInfo}\n$error';
+ var msg = '${requestTime}\t$elapsedTime\t$method\t${url}\n$error';
if(chain == null) return msg;
return '$msg\n$chain';
« no previous file with comments | « pkg/shelf/lib/shelf_io.dart ('k') | pkg/shelf/lib/src/message.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698