@@ -33,7 +33,10 @@ class OutputEvent {
33
33
OutputEvent (this .level, this .lines);
34
34
}
35
35
36
+ @Deprecated ("Use a custom LogFilter instead" )
36
37
typedef LogCallback = void Function (LogEvent event);
38
+
39
+ @Deprecated ("Use a custom LogOutput instead" )
37
40
typedef OutputCallback = void Function (OutputEvent event);
38
41
39
42
/// Use instances of logger to send log messages to the [LogPrinter] .
@@ -43,7 +46,9 @@ class Logger {
43
46
/// All logs with levels below this level will be omitted.
44
47
static Level level = Level .verbose;
45
48
49
+ // NOTE: callbacks are soon to be removed
46
50
static final Set <LogCallback > _logCallbacks = Set ();
51
+ // NOTE: callbacks are soon to be removed
47
52
static final Set <OutputCallback > _outputCallbacks = Set ();
48
53
49
54
final LogFilter _filter;
@@ -112,13 +117,15 @@ class Logger {
112
117
}
113
118
var logEvent = LogEvent (level, message, error, stackTrace);
114
119
if (_filter.shouldLog (logEvent)) {
120
+ // NOTE: callbacks are soon to be removed
115
121
for (var callback in _logCallbacks) {
116
122
callback (logEvent);
117
123
}
118
124
var output = _printer.log (logEvent);
119
125
120
126
if (output.isNotEmpty) {
121
127
var outputEvent = OutputEvent (level, output);
128
+ // NOTE: callbacks are soon to be removed
122
129
for (var callback in _outputCallbacks) {
123
130
callback (outputEvent);
124
131
}
@@ -136,25 +143,29 @@ class Logger {
136
143
}
137
144
138
145
/// Register a [LogCallback] which is called for each new [LogEvent] .
146
+ @Deprecated ("Use a custom LogFilter instead" )
139
147
static void addLogListener (LogCallback callback) {
140
148
_logCallbacks.add (callback);
141
149
}
142
150
143
151
/// Removes a [LogCallback] which was previously registered.
144
152
///
145
153
/// Returns wheter the callback was successfully removed.
154
+ @Deprecated ("Use a custom LogFilter instead" )
146
155
static bool removeLogListener (LogCallback callback) {
147
156
return _logCallbacks.remove (callback);
148
157
}
149
158
150
159
/// Register an [OutputCallback] which is called for each new [OutputEvent] .
160
+ @Deprecated ("Use a custom LogOutput instead" )
151
161
static void addOutputListener (OutputCallback callback) {
152
162
_outputCallbacks.add (callback);
153
163
}
154
164
155
165
/// Removes a [OutputCallback] which was previously registered.
156
166
///
157
167
/// Returns wheter the callback was successfully removed.
168
+ @Deprecated ("Use a custom LogOutput instead" )
158
169
static void removeOutputListener (OutputCallback callback) {
159
170
_outputCallbacks.remove (callback);
160
171
}
0 commit comments