Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(461)

Side by Side Diff: pkg/polymer/lib/src/build/wrapped_logger.dart

Issue 487793002: html escape log messages (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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': new HtmlEscape().convert(message),
kevmoo 2014/08/19 20:53:02 use the const ctor for HtmlEscape so we're not con
jakemac 2014/08/20 14:48:18 Done.
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698