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 library csslib.src.messages; | 5 library csslib.src.messages; |
6 | 6 |
7 import 'package:logging/logging.dart' show Level; | 7 import 'package:logging/logging.dart' show Level; |
8 import 'package:source_maps/span.dart' show Span; | 8 import 'package:source_maps/span.dart' show Span; |
9 | 9 |
10 import 'options.dart'; | 10 import 'options.dart'; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 var output = new StringBuffer(); | 53 var output = new StringBuffer(); |
54 bool colors = useColors && _ERROR_COLORS.containsKey(level); | 54 bool colors = useColors && _ERROR_COLORS.containsKey(level); |
55 var levelColor = _ERROR_COLORS[level]; | 55 var levelColor = _ERROR_COLORS[level]; |
56 if (colors) output.write(levelColor); | 56 if (colors) output.write(levelColor); |
57 output..write(_ERROR_LABEL[level])..write(' '); | 57 output..write(_ERROR_LABEL[level])..write(' '); |
58 if (colors) output.write(NO_COLOR); | 58 if (colors) output.write(NO_COLOR); |
59 | 59 |
60 if (span == null) { | 60 if (span == null) { |
61 output.write(message); | 61 output.write(message); |
62 } else { | 62 } else { |
| 63 output.write('on '); |
63 output.write(span.getLocationMessage(message, useColors: colors, | 64 output.write(span.getLocationMessage(message, useColors: colors, |
64 color: levelColor)); | 65 color: levelColor)); |
65 } | 66 } |
66 | 67 |
67 return output.toString(); | 68 return output.toString(); |
68 } | 69 } |
69 } | 70 } |
70 | 71 |
71 typedef void PrintHandler(Message obj); | 72 typedef void PrintHandler(Message obj); |
72 | 73 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 } | 119 } |
119 | 120 |
120 /** Merge [newMessages] to this message lsit. */ | 121 /** Merge [newMessages] to this message lsit. */ |
121 void mergeMessages(Messages newMessages) { | 122 void mergeMessages(Messages newMessages) { |
122 messages.addAll(newMessages.messages); | 123 messages.addAll(newMessages.messages); |
123 newMessages.messages.where((message) => | 124 newMessages.messages.where((message) => |
124 message.level.value == Level.SEVERE || options.verbose) | 125 message.level.value == Level.SEVERE || options.verbose) |
125 .forEach((message) { printHandler(message); }); | 126 .forEach((message) { printHandler(message); }); |
126 } | 127 } |
127 } | 128 } |
OLD | NEW |