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

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

Issue 12282038: Remove deprecated string features. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge to head 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 | « utils/pub/io.dart ('k') | utils/pub/utils.dart » ('j') | 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 /// Enables recording of log entries. 146 /// Enables recording of log entries.
147 void recordTranscript() { 147 void recordTranscript() {
148 _transcript = <Entry>[]; 148 _transcript = <Entry>[];
149 } 149 }
150 150
151 /// If [recordTranscript()] was called, then prints the previously recorded log 151 /// If [recordTranscript()] was called, then prints the previously recorded log
152 /// transcript to stderr. 152 /// transcript to stderr.
153 void dumpTranscript() { 153 void dumpTranscript() {
154 if (_transcript == null) return; 154 if (_transcript == null) return;
155 155
156 stderrSink.add('---- Log transcript ----\n'.charCodes); 156 stderrSink.add('---- Log transcript ----\n'.codeUnits);
157 for (var entry in _transcript) { 157 for (var entry in _transcript) {
158 _logToStderrWithLabel(entry); 158 _logToStderrWithLabel(entry);
159 } 159 }
160 stderrSink.add('---- End log transcript ----\n'.charCodes); 160 stderrSink.add('---- End log transcript ----\n'.codeUnits);
161 } 161 }
162 162
163 /// Sets the verbosity to "normal", which shows errors, warnings, and messages. 163 /// Sets the verbosity to "normal", which shows errors, warnings, and messages.
164 void showNormal() { 164 void showNormal() {
165 _loggers[Level.ERROR] = _logToStderr; 165 _loggers[Level.ERROR] = _logToStderr;
166 _loggers[Level.WARNING] = _logToStderr; 166 _loggers[Level.WARNING] = _logToStderr;
167 _loggers[Level.MESSAGE] = _logToStdout; 167 _loggers[Level.MESSAGE] = _logToStdout;
168 _loggers[Level.IO] = null; 168 _loggers[Level.IO] = null;
169 _loggers[Level.FINE] = null; 169 _loggers[Level.FINE] = null;
170 } 170 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(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.codeUnits);
217 sink.add(': '.charCodes); 217 sink.add(': '.codeUnits);
218 } else { 218 } else {
219 sink.add(' | '.charCodes); 219 sink.add(' | '.codeUnits);
220 } 220 }
221 } 221 }
222 222
223 sink.add(line.charCodes); 223 sink.add(line.codeUnits);
224 sink.add('\n'.charCodes); 224 sink.add('\n'.codeUnits);
225 225
226 firstLine = false; 226 firstLine = false;
227 } 227 }
228 } 228 }
OLDNEW
« no previous file with comments | « utils/pub/io.dart ('k') | utils/pub/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698