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 * Provides APIs for debugging and error logging. This library introduces | 6 * Provides APIs for debugging and error logging. This library introduces |
7 * abstractions similar to those used in other languages, such as the Closure JS | 7 * abstractions similar to those used in other languages, such as the Closure JS |
8 * Logger and java.util.logging.Logger. | 8 * Logger and java.util.logging.Logger. |
9 */ | 9 */ |
10 library logging; | 10 library logging; |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 * levels above certain [Level]. [Level]s are ordered using an integer | 240 * levels above certain [Level]. [Level]s are ordered using an integer |
241 * value [Level.value]. The predefined [Level] constants below are sorted as | 241 * value [Level.value]. The predefined [Level] constants below are sorted as |
242 * follows (in descending order): [Level.SHOUT], [Level.SEVERE], | 242 * follows (in descending order): [Level.SHOUT], [Level.SEVERE], |
243 * [Level.WARNING], [Level.INFO], [Level.CONFIG], [Level.FINE], [Level.FINER], | 243 * [Level.WARNING], [Level.INFO], [Level.CONFIG], [Level.FINE], [Level.FINER], |
244 * [Level.FINEST], and [Level.ALL]. | 244 * [Level.FINEST], and [Level.ALL]. |
245 * | 245 * |
246 * We recommend using one of the predefined logging levels. If you define your | 246 * We recommend using one of the predefined logging levels. If you define your |
247 * own level, make sure you use a value between those used in [Level.ALL] and | 247 * own level, make sure you use a value between those used in [Level.ALL] and |
248 * [Level.OFF]. | 248 * [Level.OFF]. |
249 */ | 249 */ |
250 class Level implements Comparable { | 250 class Level implements Comparable<Level> { |
251 | 251 |
252 // TODO(sigmund): mark name/value as 'const' when the language supports it. | 252 // TODO(sigmund): mark name/value as 'const' when the language supports it. |
253 final String name; | 253 final String name; |
254 | 254 |
255 /** | 255 /** |
256 * Unique value for this level. Used to order levels, so filtering can exclude | 256 * Unique value for this level. Used to order levels, so filtering can exclude |
257 * messages whose level is under certain value. | 257 * messages whose level is under certain value. |
258 */ | 258 */ |
259 final int value; | 259 final int value; |
260 | 260 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 | 325 |
326 /** Associated exception message (if any) when recording errors messages. */ | 326 /** Associated exception message (if any) when recording errors messages. */ |
327 String exceptionText; | 327 String exceptionText; |
328 | 328 |
329 LogRecord( | 329 LogRecord( |
330 this.level, this.message, this.loggerName, | 330 this.level, this.message, this.loggerName, |
331 [time, this.exception, this.exceptionText]) : | 331 [time, this.exception, this.exceptionText]) : |
332 this.time = (time == null) ? new DateTime.now() : time, | 332 this.time = (time == null) ? new DateTime.now() : time, |
333 this.sequenceNumber = LogRecord._nextNumber++; | 333 this.sequenceNumber = LogRecord._nextNumber++; |
334 } | 334 } |
OLD | NEW |