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

Side by Side Diff: lib/src/handlers/logger.dart

Issue 1032623005: pkg/shelf: spelling fixes (Closed) Base URL: https://github.com/dart-lang/shelf.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library shelf.handlers.logger; 5 library shelf.handlers.logger;
6 6
7 import 'package:stack_trace/stack_trace.dart'; 7 import 'package:stack_trace/stack_trace.dart';
8 8
9 import '../hijack_exception.dart'; 9 import '../hijack_exception.dart';
10 import '../middleware.dart'; 10 import '../middleware.dart';
11 import '../util.dart'; 11 import '../util.dart';
12 12
13 /// Middleware which prints the time of the request, the elapsed time for the 13 /// Middleware which prints the time of the request, the elapsed time for the
14 /// inner handlers, the response's status code and the request URI. 14 /// inner handlers, the response's status code and the request URI.
15 /// 15 ///
16 /// [logger] takes two paramaters. 16 /// [logger] takes two parameters.
17 /// 17 ///
18 /// `msg` includes the request time, duration, request method, and requested 18 /// `msg` includes the request time, duration, request method, and requested
19 /// path. 19 /// path.
20 /// 20 ///
21 /// For successful requests, `msg` also includes the status code. 21 /// For successful requests, `msg` also includes the status code.
22 /// 22 ///
23 /// When an error is thrown, `isError` is true and `msg` contains the error 23 /// When an error is thrown, `isError` is true and `msg` contains the error
24 /// description and stack trace. 24 /// description and stack trace.
25 Middleware logRequests({void logger(String msg, bool isError)}) => 25 Middleware logRequests({void logger(String msg, bool isError)}) =>
26 (innerHandler) { 26 (innerHandler) {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 return '$msg\n$chain'; 71 return '$msg\n$chain';
72 } 72 }
73 73
74 void _defaultLogger(String msg, bool isError) { 74 void _defaultLogger(String msg, bool isError) {
75 if (isError) { 75 if (isError) {
76 print('[ERROR] $msg'); 76 print('[ERROR] $msg');
77 } else { 77 } else {
78 print(msg); 78 print(msg);
79 } 79 }
80 } 80 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698