| 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 polymer.src.build.wrapped_logger; | 5 library polymer.src.build.wrapped_logger; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 | 9 |
| 10 import 'package:barback/barback.dart'; | 10 import 'package:barback/barback.dart'; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 transform.addOutput(new Asset.fromString( | 80 transform.addOutput(new Asset.fromString( |
| 81 primaryInputId.addExtension(common.LOG_EXTENSION), | 81 primaryInputId.addExtension(common.LOG_EXTENSION), |
| 82 JSON.encode(logs))); | 82 JSON.encode(logs))); |
| 83 }); | 83 }); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void _addLog(AssetId assetId, LogLevel level, String message, | 86 void _addLog(AssetId assetId, LogLevel level, String message, |
| 87 SourceSpan span) { | 87 SourceSpan span) { |
| 88 var data = { | 88 var data = { |
| 89 'level': level.name, | 89 'level': level.name, |
| 90 'message': message, | 90 'message': const HtmlEscape().convert(message), |
| 91 }; | 91 }; |
| 92 if (assetId != null) { | 92 if (assetId != null) { |
| 93 data['assetId'] = { | 93 data['assetId'] = { |
| 94 'package': assetId.package, | 94 'package': assetId.package, |
| 95 'path': assetId.path, | 95 'path': assetId.path, |
| 96 }; | 96 }; |
| 97 } | 97 } |
| 98 if (span != null) { | 98 if (span != null) { |
| 99 data['span'] = { | 99 data['span'] = { |
| 100 'location': span.start.toolString, | 100 'location': span.start.toolString, |
| 101 'text': new HtmlEscape().convert(span.text), | 101 'text': new HtmlEscape().convert(span.text), |
| 102 }; | 102 }; |
| 103 } | 103 } |
| 104 _logs.add(data); | 104 _logs.add(data); |
| 105 } | 105 } |
| 106 } | 106 } |
| OLD | NEW |