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 * Support for logging. | 6 * Support for logging. |
7 * | 7 * |
8 * For information on installing and importing this library, see the | 8 * For information on installing and importing this library, see the |
9 * [logging package on pub.dartlang.org] | 9 * [logging package on pub.dartlang.org] |
10 * (http://pub.dartlang.org/packages/logging). | 10 * (http://pub.dartlang.org/packages/logging). |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 | 304 |
305 /** Key for potential problems ([value] = 900). */ | 305 /** Key for potential problems ([value] = 900). */ |
306 static const Level WARNING = const Level('WARNING', 900); | 306 static const Level WARNING = const Level('WARNING', 900); |
307 | 307 |
308 /** Key for serious failures ([value] = 1000). */ | 308 /** Key for serious failures ([value] = 1000). */ |
309 static const Level SEVERE = const Level('SEVERE', 1000); | 309 static const Level SEVERE = const Level('SEVERE', 1000); |
310 | 310 |
311 /** Key for extra debugging loudness ([value] = 1200). */ | 311 /** Key for extra debugging loudness ([value] = 1200). */ |
312 static const Level SHOUT = const Level('SHOUT', 1200); | 312 static const Level SHOUT = const Level('SHOUT', 1200); |
313 | 313 |
| 314 static const List<Level> LEVELS = const |
| 315 [ALL, FINEST, FINER, FINE, CONFIG, INFO, WARNING, SEVERE, SHOUT, OFF]; |
| 316 |
314 bool operator ==(Object other) => other is Level && value == other.value; | 317 bool operator ==(Object other) => other is Level && value == other.value; |
315 bool operator <(Level other) => value < other.value; | 318 bool operator <(Level other) => value < other.value; |
316 bool operator <=(Level other) => value <= other.value; | 319 bool operator <=(Level other) => value <= other.value; |
317 bool operator >(Level other) => value > other.value; | 320 bool operator >(Level other) => value > other.value; |
318 bool operator >=(Level other) => value >= other.value; | 321 bool operator >=(Level other) => value >= other.value; |
319 int compareTo(Level other) => value - other.value; | 322 int compareTo(Level other) => value - other.value; |
320 int get hashCode => value; | 323 int get hashCode => value; |
321 String toString() => name; | 324 String toString() => name; |
322 } | 325 } |
323 | 326 |
(...skipping 23 matching lines...) Expand all Loading... |
347 /** Associated stackTrace (if any) when recording errors messages. */ | 350 /** Associated stackTrace (if any) when recording errors messages. */ |
348 final StackTrace stackTrace; | 351 final StackTrace stackTrace; |
349 | 352 |
350 LogRecord(this.level, this.message, this.loggerName, [this.error, | 353 LogRecord(this.level, this.message, this.loggerName, [this.error, |
351 this.stackTrace]) | 354 this.stackTrace]) |
352 : time = new DateTime.now(), | 355 : time = new DateTime.now(), |
353 sequenceNumber = LogRecord._nextNumber++; | 356 sequenceNumber = LogRecord._nextNumber++; |
354 | 357 |
355 String toString() => '[${level.name}] $loggerName: $message'; | 358 String toString() => '[${level.name}] $loggerName: $message'; |
356 } | 359 } |
OLD | NEW |