| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 */ | 84 */ |
| 85 Level get level { | 85 Level get level { |
| 86 if (hierarchicalLoggingEnabled) { | 86 if (hierarchicalLoggingEnabled) { |
| 87 if (_level != null) return _level; | 87 if (_level != null) return _level; |
| 88 if (parent != null) return parent.level; | 88 if (parent != null) return parent.level; |
| 89 } | 89 } |
| 90 return _rootLevel; | 90 return _rootLevel; |
| 91 } | 91 } |
| 92 | 92 |
| 93 /** Override the level for this particular [Logger] and its children. */ | 93 /** Override the level for this particular [Logger] and its children. */ |
| 94 Level set level(value) { | 94 set level(value) { |
| 95 if (hierarchicalLoggingEnabled && parent != null) { | 95 if (hierarchicalLoggingEnabled && parent != null) { |
| 96 _level = value; | 96 _level = value; |
| 97 } else { | 97 } else { |
| 98 if (parent != null) { | 98 if (parent != null) { |
| 99 throw new UnsupportedOperationException( | 99 throw new UnsupportedOperationException( |
| 100 'Please set "hierarchicalLoggingEnabled" to true if you want to ' | 100 'Please set "hierarchicalLoggingEnabled" to true if you want to ' |
| 101 'change the level on a non-root logger.'); | 101 'change the level on a non-root logger.'); |
| 102 } | 102 } |
| 103 _rootLevel = value; | 103 _rootLevel = value; |
| 104 } | 104 } |
| (...skipping 220 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 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 |