| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 /// This library provides a single function called injectLogs which when called | 5 /// This library provides a single function called injectLogs which when called |
| 6 /// will request a logs json file and build a small widget out of them which | 6 /// will request a logs json file and build a small widget out of them which |
| 7 /// groups the logs by level. | 7 /// groups the logs by level. |
| 8 library polymer.build.log_injector; | 8 library polymer.build.log_injector; |
| 9 | 9 |
| 10 import 'dart:convert'; | 10 import 'dart:convert'; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 sb.write(_escape(context.substring(span.end.column))); | 66 sb.write(_escape(context.substring(span.end.column))); |
| 67 } else { | 67 } else { |
| 68 sb.write(_escape(span.text)); | 68 sb.write(_escape(span.text)); |
| 69 } | 69 } |
| 70 sb.write('</span></div></div>'); | 70 sb.write('</span></div></div>'); |
| 71 } | 71 } |
| 72 sb.write('</div>'); | 72 sb.write('</div>'); |
| 73 | 73 |
| 74 var logElement = new Element.html('$sb', | 74 var logElement = new Element.html('$sb', |
| 75 validator: new NodeValidatorBuilder.common() | 75 validator: new NodeValidatorBuilder.common() |
| 76 ..allowNavigation(new _OpenUriPolicy())); | 76 ..allowNavigation(new _OpenUriPolicy())); |
| 77 contentItem.append(logElement); | 77 contentItem.append(logElement); |
| 78 var messageElement = logElement.querySelector('div.text'); | 78 var messageElement = logElement.querySelector('div.text'); |
| 79 messageElement.onClick.listen((e) { | 79 messageElement.onClick.listen((e) { |
| 80 if (e.target == messageElement) { | 80 if (e.target == messageElement) { |
| 81 messageElement.classes.toggle('expanded'); | 81 messageElement.classes.toggle('expanded'); |
| 82 } | 82 } |
| 83 }); | 83 }); |
| 84 } | 84 } |
| 85 }); | 85 }); |
| 86 | 86 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 class _Visitor extends RecursiveSummaryVisitor { | 123 class _Visitor extends RecursiveSummaryVisitor { |
| 124 final Map<String, List<MessageSummary>> messagesByLevel = {}; | 124 final Map<String, List<MessageSummary>> messagesByLevel = {}; |
| 125 | 125 |
| 126 @override | 126 @override |
| 127 void visitMessage(MessageSummary message) { | 127 void visitMessage(MessageSummary message) { |
| 128 var level = message.level.toLowerCase(); | 128 var level = message.level.toLowerCase(); |
| 129 messagesByLevel.putIfAbsent(level, () => []); | 129 messagesByLevel.putIfAbsent(level, () => []); |
| 130 messagesByLevel[level].add(message); | 130 messagesByLevel[level].add(message); |
| 131 } | 131 } |
| 132 } | 132 } |
| OLD | NEW |