| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /// Message logging. | 5 /// Message logging. |
| 6 library log; | 6 library log; |
| 7 | 7 |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 import 'io.dart'; | 9 import 'io.dart'; |
| 10 | 10 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 /// If [endMessage] is omitted, then logs "Begin [startMessage]" before the | 90 /// If [endMessage] is omitted, then logs "Begin [startMessage]" before the |
| 91 /// operation and "End [startMessage]" after it. | 91 /// operation and "End [startMessage]" after it. |
| 92 Future ioAsync(String startMessage, Future operation, | 92 Future ioAsync(String startMessage, Future operation, |
| 93 [String endMessage(value)]) { | 93 [String endMessage(value)]) { |
| 94 if (endMessage == null) { | 94 if (endMessage == null) { |
| 95 io("Begin $startMessage."); | 95 io("Begin $startMessage."); |
| 96 } else { | 96 } else { |
| 97 io(startMessage); | 97 io(startMessage); |
| 98 } | 98 } |
| 99 | 99 |
| 100 return operation.transform((result) { | 100 return operation.then((result) { |
| 101 if (endMessage == null) { | 101 if (endMessage == null) { |
| 102 io("End $startMessage."); | 102 io("End $startMessage."); |
| 103 } else { | 103 } else { |
| 104 io(endMessage(result)); | 104 io(endMessage(result)); |
| 105 } | 105 } |
| 106 return result; | 106 return result; |
| 107 }); | 107 }); |
| 108 } | 108 } |
| 109 | 109 |
| 110 /// Logs the spawning of an [executable] process with [arguments] at [IO] | 110 /// Logs the spawning of an [executable] process with [arguments] at [IO] |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 stream.writeString(' | '); | 219 stream.writeString(' | '); |
| 220 } | 220 } |
| 221 } | 221 } |
| 222 | 222 |
| 223 stream.writeString(line); | 223 stream.writeString(line); |
| 224 stream.writeString('\n'); | 224 stream.writeString('\n'); |
| 225 | 225 |
| 226 firstLine = false; | 226 firstLine = false; |
| 227 } | 227 } |
| 228 } | 228 } |
| OLD | NEW |