Make asBroadcastStream take two callbacks.
These callbacks will be called when the broadcast stream no longer
has any listeners, or when it gets a listener after having none.
The callback is provided with a StreamSubscription-like object where
it can pause/resume/cancel the underlying subscription on the original
stream.
BUG=http://dartbug.com/11289
R=floitsch@google.com
Review URL: https://codereview.chromium.org//17490002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart/pkg/logging@24776 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/lib/logging.dart b/lib/logging.dart
index 3c841dc..28fbc2f 100644
--- a/lib/logging.dart
+++ b/lib/logging.dart
@@ -203,8 +203,8 @@
Stream<LogRecord> _getStream() {
if (hierarchicalLoggingEnabled || parent == null) {
if (_controller == null) {
- _controller = new StreamController<LogRecord>(sync: true);
- _stream = _controller.stream.asBroadcastStream();
+ _controller = new StreamController<LogRecord>.broadcast(sync: true);
+ _stream = _controller.stream;
}
return _stream;
} else {