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

Side by Side Diff: pkg/logging/lib/logging.dart

Issue 17490002: Make asBroadcastStream take two callbacks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reintroduce zone. Created 7 years, 6 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 | « no previous file | pkg/scheduled_test/lib/src/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 /** 5 /**
6 * Provides APIs for debugging and error logging. This library introduces 6 * Provides APIs for debugging and error logging. This library introduces
7 * abstractions similar to those used in other languages, such as the Closure JS 7 * abstractions similar to those used in other languages, such as the Closure JS
8 * Logger and java.util.logging.Logger. 8 * Logger and java.util.logging.Logger.
9 * 9 *
10 * ## Installing ## 10 * ## Installing ##
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 void severe(String message, [exception]) => 196 void severe(String message, [exception]) =>
197 log(Level.SEVERE, message, exception); 197 log(Level.SEVERE, message, exception);
198 198
199 /** Log message at level [Level.SHOUT]. */ 199 /** Log message at level [Level.SHOUT]. */
200 void shout(String message, [exception]) => 200 void shout(String message, [exception]) =>
201 log(Level.SHOUT, message, exception); 201 log(Level.SHOUT, message, exception);
202 202
203 Stream<LogRecord> _getStream() { 203 Stream<LogRecord> _getStream() {
204 if (hierarchicalLoggingEnabled || parent == null) { 204 if (hierarchicalLoggingEnabled || parent == null) {
205 if (_controller == null) { 205 if (_controller == null) {
206 _controller = new StreamController<LogRecord>(sync: true); 206 _controller = new StreamController<LogRecord>.broadcast(sync: true);
207 _stream = _controller.stream.asBroadcastStream(); 207 _stream = _controller.stream;
208 } 208 }
209 return _stream; 209 return _stream;
210 } else { 210 } else {
211 return root._getStream(); 211 return root._getStream();
212 } 212 }
213 } 213 }
214 214
215 void _publish(LogRecord record) { 215 void _publish(LogRecord record) {
216 if (_controller != null) { 216 if (_controller != null) {
217 _controller.add(record); 217 _controller.add(record);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 314
315 static int _nextNumber = 0; 315 static int _nextNumber = 0;
316 316
317 /** Associated exception (if any) when recording errors messages. */ 317 /** Associated exception (if any) when recording errors messages. */
318 var exception; 318 var exception;
319 319
320 LogRecord(this.level, this.message, this.loggerName, [this.exception]) 320 LogRecord(this.level, this.message, this.loggerName, [this.exception])
321 : time = new DateTime.now(), 321 : time = new DateTime.now(),
322 sequenceNumber = LogRecord._nextNumber++; 322 sequenceNumber = LogRecord._nextNumber++;
323 } 323 }
OLDNEW
« no previous file with comments | « no previous file | pkg/scheduled_test/lib/src/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698