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

Side by Side Diff: utils/pub/log.dart

Issue 12154006: Remove Sink and move CollectionSink to async. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove usage of Sink from pub. Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « tests/lib/async/event_helper.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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:async'; 8 import 'dart:async';
9 import 'io.dart'; 9 import 'io.dart';
10 10
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 /// Log function that prints the message to stderr. 201 /// Log function that prints the message to stderr.
202 void _logToStderr(Entry entry) { 202 void _logToStderr(Entry entry) {
203 _logToStream(stderrSink, entry, showLabel: false); 203 _logToStream(stderrSink, entry, showLabel: false);
204 } 204 }
205 205
206 /// Log function that prints the message to stderr with the level name. 206 /// Log function that prints the message to stderr with the level name.
207 void _logToStderrWithLabel(Entry entry) { 207 void _logToStderrWithLabel(Entry entry) {
208 _logToStream(stderrSink, entry, showLabel: true); 208 _logToStream(stderrSink, entry, showLabel: true);
209 } 209 }
210 210
211 void _logToStream(Sink<List<int>> sink, Entry entry, {bool showLabel}) { 211 void _logToStream(StreamSink<List<int>> sink, Entry entry, {bool showLabel}) {
212 bool firstLine = true; 212 bool firstLine = true;
213 for (var line in entry.lines) { 213 for (var line in entry.lines) {
214 if (showLabel) { 214 if (showLabel) {
215 if (firstLine) { 215 if (firstLine) {
216 sink.add(entry.level.name.charCodes); 216 sink.add(entry.level.name.charCodes);
217 sink.add(': '.charCodes); 217 sink.add(': '.charCodes);
218 } else { 218 } else {
219 sink.add(' | '.charCodes); 219 sink.add(' | '.charCodes);
220 } 220 }
221 } 221 }
222 222
223 sink.add(line.charCodes); 223 sink.add(line.charCodes);
224 sink.add('\n'.charCodes); 224 sink.add('\n'.charCodes);
225 225
226 firstLine = false; 226 firstLine = false;
227 } 227 }
228 } 228 }
OLDNEW
« no previous file with comments | « tests/lib/async/event_helper.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698