| 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 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 261 const Level(this.name, this.value); | 261 const Level(this.name, this.value); |
| 262 | 262 |
| 263 /** Special key to turn on logging for all levels ([value] = 0). */ | 263 /** Special key to turn on logging for all levels ([value] = 0). */ |
| 264 static final Level ALL = const Level('ALL', 0); | 264 static const Level ALL = const Level('ALL', 0); |
| 265 | 265 |
| 266 /** Special key to turn off all logging ([value] = 2000). */ | 266 /** Special key to turn off all logging ([value] = 2000). */ |
| 267 static final Level OFF = const Level('OFF', 2000); | 267 static const Level OFF = const Level('OFF', 2000); |
| 268 | 268 |
| 269 /** Key for highly detailed tracing ([value] = 300). */ | 269 /** Key for highly detailed tracing ([value] = 300). */ |
| 270 static final Level FINEST = const Level('FINEST', 300); | 270 static const Level FINEST = const Level('FINEST', 300); |
| 271 | 271 |
| 272 /** Key for fairly detailed tracing ([value] = 400). */ | 272 /** Key for fairly detailed tracing ([value] = 400). */ |
| 273 static final Level FINER = const Level('FINER', 400); | 273 static const Level FINER = const Level('FINER', 400); |
| 274 | 274 |
| 275 /** Key for tracing information ([value] = 500). */ | 275 /** Key for tracing information ([value] = 500). */ |
| 276 static final Level FINE = const Level('FINE', 500); | 276 static const Level FINE = const Level('FINE', 500); |
| 277 | 277 |
| 278 /** Key for static configuration messages ([value] = 700). */ | 278 /** Key for static configuration messages ([value] = 700). */ |
| 279 static final Level CONFIG = const Level('CONFIG', 700); | 279 static const Level CONFIG = const Level('CONFIG', 700); |
| 280 | 280 |
| 281 /** Key for informational messages ([value] = 800). */ | 281 /** Key for informational messages ([value] = 800). */ |
| 282 static final Level INFO = const Level('INFO', 800); | 282 static const Level INFO = const Level('INFO', 800); |
| 283 | 283 |
| 284 /** Key for potential problems ([value] = 900). */ | 284 /** Key for potential problems ([value] = 900). */ |
| 285 static final Level WARNING = const Level('WARNING', 900); | 285 static const Level WARNING = const Level('WARNING', 900); |
| 286 | 286 |
| 287 /** Key for serious failures ([value] = 1000). */ | 287 /** Key for serious failures ([value] = 1000). */ |
| 288 static final Level SEVERE = const Level('SEVERE', 1000); | 288 static const Level SEVERE = const Level('SEVERE', 1000); |
| 289 | 289 |
| 290 /** Key for extra debugging loudness ([value] = 1200). */ | 290 /** Key for extra debugging loudness ([value] = 1200). */ |
| 291 static final Level SHOUT = const Level('SHOUT', 1200); | 291 static const Level SHOUT = const Level('SHOUT', 1200); |
| 292 | 292 |
| 293 bool operator ==(Level other) => other != null && value == other.value; | 293 bool operator ==(Level other) => other != null && value == other.value; |
| 294 bool operator <(Level other) => value < other.value; | 294 bool operator <(Level other) => value < other.value; |
| 295 bool operator <=(Level other) => value <= other.value; | 295 bool operator <=(Level other) => value <= other.value; |
| 296 bool operator >(Level other) => value > other.value; | 296 bool operator >(Level other) => value > other.value; |
| 297 bool operator >=(Level other) => value >= other.value; | 297 bool operator >=(Level other) => value >= other.value; |
| 298 int compareTo(Level other) => value - other.value; | 298 int compareTo(Level other) => value - other.value; |
| 299 int hashCode() => value; | 299 int hashCode() => value; |
| 300 String toString() => name; | 300 String toString() => name; |
| 301 } | 301 } |
| (...skipping 23 matching lines...) Expand all 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 Date.now() : time, | 332 this.time = (time == null) ? new Date.now() : time, |
| 333 this.sequenceNumber = LogRecord._nextNumber++; | 333 this.sequenceNumber = LogRecord._nextNumber++; |
| 334 } | 334 } |
| OLD | NEW |