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

Unified Diff: pkg/logging/lib/logging.dart

Issue 12600033: pkg/logging: removed deprecated 'on' API (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/logging/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/logging/lib/logging.dart
diff --git a/pkg/logging/lib/logging.dart b/pkg/logging/lib/logging.dart
index 1bf617c58d41d91a4116e332c53f7290e42c3913..d2610b1c818399c36b8f2913dfd0a76311b11e43 100644
--- a/pkg/logging/lib/logging.dart
+++ b/pkg/logging/lib/logging.dart
@@ -11,8 +11,6 @@ library logging;
import 'dart:async';
-import '../../meta/lib/meta.dart';
-
/**
* Whether to allow fine-grain logging and configuration of loggers in a
* hierarchy. When false, all logging is merged in the root logger.
@@ -50,9 +48,6 @@ class Logger {
/** Controller used to notify when log entries are added to this logger. */
StreamController<LogRecord> _controller;
- // TODO(sigmund): remove together with the deprecated [on] API.
- Map<LoggerHandler, StreamSubscription> _deprecatedSubscriptions;
-
/**
* Singleton constructor. Calling `new Logger(name)` will return the same
* actual instance whenever it is called with the same string name.
@@ -112,17 +107,6 @@ class Logger {
}
/**
- * Returns an event manager for this [Logger]. You can listen for log messages
- * by adding a [LoggerHandler] to an event from the event manager, for
- * instance:
- * logger.on.record.add((record) { ... });
- *
- * This API is Deprecated. Use [onRecord] instead.
- */
- @deprecated
- LoggerEvents get on => new LoggerEvents(this);
-
- /**
* Returns an stream of messages added to this [Logger]. You can listen for
* messages using the standard stream APIs, for instance:
* logger.onRecord.listen((record) { ... });
@@ -201,27 +185,6 @@ class Logger {
}
}
- /** Adds a handler to listen whenever a log record is added to this logger. */
- void _addHandler(LoggerHandler handler) {
- if (_deprecatedSubscriptions == null) {
- _deprecatedSubscriptions = new Map<LoggerHandler, StreamSubscription>();
- }
-
- _deprecatedSubscriptions[handler] = onRecord.listen(handler);
- }
-
- void _removeHandler(LoggerHandler handler) {
- if (_deprecatedSubscriptions != null) {
- var sub = _deprecatedSubscriptions.remove(handler);
- if (sub != null) {
- sub.cancel();
- }
- if (_deprecatedSubscriptions.isEmpty) {
- _deprecatedSubscriptions = null;
- }
- }
- }
-
void _publish(LogRecord record) {
if (_controller != null) {
_controller.add(record);
@@ -239,30 +202,6 @@ class Logger {
/** Handler callback to process log entries as they are added to a [Logger]. */
typedef void LoggerHandler(LogRecord);
-
-/** Event manager for a [Logger] (holds events that a [Logger] can fire). */
-class LoggerEvents {
- final Logger _logger;
-
- LoggerEvents(this._logger);
-
- /** Event fired when a log record is added to a [Logger]. */
- LoggerHandlerList get record => new LoggerHandlerList(_logger);
-}
-
-
-/** List of handlers that will be called on a logger event. */
-class LoggerHandlerList {
- Logger _logger;
-
- LoggerHandlerList(this._logger);
-
- void add(LoggerHandler handler) => _logger._addHandler(handler);
- void remove(LoggerHandler handler) => _logger._removeHandler(handler);
- void clear() => _logger.clearListeners();
-}
-
-
/**
* [Level]s to control logging output. Logging can be enabled to include all
* levels above certain [Level]. [Level]s are ordered using an integer
« no previous file with comments | « no previous file | pkg/logging/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698