OLD | NEW |
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 */ | 6 */ |
7 library logging; | 7 library logging; |
8 | 8 |
9 import 'dart:async'; | 9 import 'dart:async'; |
10 import 'dart:collection'; | 10 import 'dart:collection'; |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 | 271 |
272 /** Key for serious failures ([value] = 1000). */ | 272 /** Key for serious failures ([value] = 1000). */ |
273 static const Level SEVERE = const Level('SEVERE', 1000); | 273 static const Level SEVERE = const Level('SEVERE', 1000); |
274 | 274 |
275 /** Key for extra debugging loudness ([value] = 1200). */ | 275 /** Key for extra debugging loudness ([value] = 1200). */ |
276 static const Level SHOUT = const Level('SHOUT', 1200); | 276 static const Level SHOUT = const Level('SHOUT', 1200); |
277 | 277 |
278 static const List<Level> LEVELS = const | 278 static const List<Level> LEVELS = const |
279 [ALL, FINEST, FINER, FINE, CONFIG, INFO, WARNING, SEVERE, SHOUT, OFF]; | 279 [ALL, FINEST, FINER, FINE, CONFIG, INFO, WARNING, SEVERE, SHOUT, OFF]; |
280 | 280 |
281 bool operator ==(Object other) => other is Level && value == other.value; | 281 bool operator ==(other) => other is Level && value == other.value; |
282 bool operator <(Level other) => value < other.value; | 282 bool operator <(Level other) => value < other.value; |
283 bool operator <=(Level other) => value <= other.value; | 283 bool operator <=(Level other) => value <= other.value; |
284 bool operator >(Level other) => value > other.value; | 284 bool operator >(Level other) => value > other.value; |
285 bool operator >=(Level other) => value >= other.value; | 285 bool operator >=(Level other) => value >= other.value; |
286 int compareTo(Level other) => value - other.value; | 286 int compareTo(Level other) => value - other.value; |
287 int get hashCode => value; | 287 int get hashCode => value; |
288 String toString() => name; | 288 String toString() => name; |
289 } | 289 } |
290 | 290 |
291 | 291 |
(...skipping 22 matching lines...) Expand all Loading... |
314 /** Associated stackTrace (if any) when recording errors messages. */ | 314 /** Associated stackTrace (if any) when recording errors messages. */ |
315 final StackTrace stackTrace; | 315 final StackTrace stackTrace; |
316 | 316 |
317 LogRecord(this.level, this.message, this.loggerName, [this.error, | 317 LogRecord(this.level, this.message, this.loggerName, [this.error, |
318 this.stackTrace]) | 318 this.stackTrace]) |
319 : time = new DateTime.now(), | 319 : time = new DateTime.now(), |
320 sequenceNumber = LogRecord._nextNumber++; | 320 sequenceNumber = LogRecord._nextNumber++; |
321 | 321 |
322 String toString() => '[${level.name}] $loggerName: $message'; | 322 String toString() => '[${level.name}] $loggerName: $message'; |
323 } | 323 } |
OLD | NEW |