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

Side by Side Diff: lib/src/messages.dart

Issue 49223002: fix webui for sdk 0.8.7 (Closed) Base URL: git@github.com:dart-lang/web-ui.git@master
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « lib/src/html_css_fixup.dart ('k') | lib/src/utils_observe.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 messages; 5 library messages;
6 6
7 import 'dart:json' as json; 7 import 'dart:convert';
8 8
9 import 'package:source_maps/span.dart' show Span; 9 import 'package:source_maps/span.dart' show Span;
10 import 'package:logging/logging.dart' show Level; 10 import 'package:logging/logging.dart' show Level;
11 11
12 import 'options.dart'; 12 import 'options.dart';
13 import 'utils.dart'; 13 import 'utils.dart';
14 14
15 /** Map between error levels and their display color. */ 15 /** Map between error levels and their display color. */
16 final Map<Level, String> _ERROR_COLORS = (() { 16 final Map<Level, String> _ERROR_COLORS = (() {
17 var colorsMap = new Map<Level, String>(); 17 var colorsMap = new Map<Level, String>();
(...skipping 28 matching lines...) Expand all
46 } else { 46 } else {
47 output.write(span.getLocationMessage(message, useColors: colors, 47 output.write(span.getLocationMessage(message, useColors: colors,
48 color: levelColor)); 48 color: levelColor));
49 } 49 }
50 50
51 return output.toString(); 51 return output.toString();
52 } 52 }
53 53
54 String toJson() { 54 String toJson() {
55 if (span == null) return toString(); 55 if (span == null) return toString();
56 return json.stringify([{ 56 return JSON.encode([{
57 'method': kind, 57 'method': kind,
58 'params': { 58 'params': {
59 'file': span.sourceUrl, 59 'file': span.sourceUrl,
60 'message': message, 60 'message': message,
61 'line': span.start.line + 1, 61 'line': span.start.line + 1,
62 'charStart': span.start.offset, 62 'charStart': span.start.offset,
63 'charEnd': span.end.offset, 63 'charEnd': span.end.offset,
64 } 64 }
65 }]); 65 }]);
66 } 66 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 useColors: options.useColors); 139 useColors: options.useColors);
140 140
141 messages.add(msg); 141 messages.add(msg);
142 if (options.verbose) printMessage(msg); 142 if (options.verbose) printMessage(msg);
143 } 143 }
144 144
145 void printMessage(msg) { 145 void printMessage(msg) {
146 if (shouldPrint) print(options.jsonFormat ? msg.toJson() : msg); 146 if (shouldPrint) print(options.jsonFormat ? msg.toJson() : msg);
147 } 147 }
148 } 148 }
OLDNEW
« no previous file with comments | « lib/src/html_css_fixup.dart ('k') | lib/src/utils_observe.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698