OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library barback.log; | 5 library barback.log; |
6 | 6 |
7 import 'package:source_maps/span.dart'; | |
8 | |
9 import 'asset/asset_id.dart'; | 7 import 'asset/asset_id.dart'; |
10 import 'errors.dart'; | 8 import 'errors.dart'; |
11 | 9 |
12 /// The severity of a logged message. | 10 /// The severity of a logged message. |
13 class LogLevel { | 11 class LogLevel { |
14 static const INFO = const LogLevel("Info"); | 12 static const INFO = const LogLevel("Info"); |
15 static const FINE = const LogLevel("Fine"); | 13 static const FINE = const LogLevel("Fine"); |
16 static const WARNING = const LogLevel("Warning"); | 14 static const WARNING = const LogLevel("Warning"); |
17 static const ERROR = const LogLevel("Error"); | 15 static const ERROR = const LogLevel("Error"); |
18 | 16 |
19 final String name; | 17 final String name; |
20 const LogLevel(this.name); | 18 const LogLevel(this.name); |
21 | 19 |
22 String toString() => name; | 20 String toString() => name; |
23 } | 21 } |
24 | 22 |
25 /// One message logged during a transform. | 23 /// One message logged during a transform. |
26 class LogEntry { | 24 class LogEntry { |
27 /// The transform that logged the message. | 25 /// The transform that logged the message. |
28 final TransformInfo transform; | 26 final TransformInfo transform; |
29 | 27 |
30 /// The asset that the message is associated with. | 28 /// The asset that the message is associated with. |
31 final AssetId assetId; | 29 final AssetId assetId; |
32 | 30 |
33 final LogLevel level; | 31 final LogLevel level; |
34 final String message; | 32 final String message; |
35 | 33 |
36 /// The location that the message pertains to or null if not associated with | 34 /// The location that the message pertains to or null if not associated with |
37 /// a source [Span]. | 35 /// a source [Span]. |
38 final Span span; | 36 final SourceSpan span; |
39 | 37 |
40 LogEntry(this.transform, this.assetId, this.level, this.message, this.span); | 38 LogEntry(this.transform, this.assetId, this.level, this.message, this.span); |
41 } | 39 } |
OLD | NEW |