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

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

Issue 12610006: Renamed StreamSink to EventSink. Renamed signalError to addError. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Changed inheritance back! Now create StreamSink instead of EventSink where we create them. Created 7 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 | Annotate | Revision Log
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(StreamSink<List<int>> sink, Entry entry, {bool showLabel}) { 211 void _logToStream(EventSink<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.codeUnits); 216 sink.add(entry.level.name.codeUnits);
217 sink.add(': '.codeUnits); 217 sink.add(': '.codeUnits);
218 } else { 218 } else {
219 sink.add(' | '.codeUnits); 219 sink.add(' | '.codeUnits);
220 } 220 }
221 } 221 }
222 222
223 sink.add(line.codeUnits); 223 sink.add(line.codeUnits);
224 sink.add('\n'.codeUnits); 224 sink.add('\n'.codeUnits);
225 225
226 firstLine = false; 226 firstLine = false;
227 } 227 }
228 } 228 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698