OLD | NEW |
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; | |
6 | |
7 import 'dart:async'; | 5 import 'dart:async'; |
8 | 6 |
9 import 'package:stack_trace/stack_trace.dart'; | 7 import 'package:stack_trace/stack_trace.dart'; |
10 | 8 |
11 import '../hijack_exception.dart'; | 9 import '../hijack_exception.dart'; |
12 import '../middleware.dart'; | 10 import '../middleware.dart'; |
13 | 11 |
14 /// Middleware which prints the time of the request, the elapsed time for the | 12 /// Middleware which prints the time of the request, the elapsed time for the |
15 /// inner handlers, the response's status code and the request URI. | 13 /// inner handlers, the response's status code and the request URI. |
16 /// | 14 /// |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 return '$msg\n$chain'; | 74 return '$msg\n$chain'; |
77 } | 75 } |
78 | 76 |
79 void _defaultLogger(String msg, bool isError) { | 77 void _defaultLogger(String msg, bool isError) { |
80 if (isError) { | 78 if (isError) { |
81 print('[ERROR] $msg'); | 79 print('[ERROR] $msg'); |
82 } else { | 80 } else { |
83 print(msg); | 81 print(msg); |
84 } | 82 } |
85 } | 83 } |
OLD | NEW |