| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 analyzer.instrumentation.instrumentation; | 5 library analyzer.instrumentation.instrumentation; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 | 9 |
| 10 import 'package:analyzer/task/model.dart'; | 10 import 'package:analyzer/task/model.dart'; |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 .log(_join([TAG_PERFORMANCE, kind, elapsed, message])); | 206 .log(_join([TAG_PERFORMANCE, kind, elapsed, message])); |
| 207 } | 207 } |
| 208 } | 208 } |
| 209 | 209 |
| 210 /** | 210 /** |
| 211 * Log the fact that an error, described by the given [message], was reported | 211 * Log the fact that an error, described by the given [message], was reported |
| 212 * by the given [plugin]. | 212 * by the given [plugin]. |
| 213 */ | 213 */ |
| 214 void logPluginError( | 214 void logPluginError( |
| 215 PluginData plugin, String code, String message, String stackTrace) { | 215 PluginData plugin, String code, String message, String stackTrace) { |
| 216 List<String> fields = <String>[TAG_PLUGIN_ERROR, code, message, stackTrace]; | 216 if (_instrumentationServer != null) { |
| 217 plugin.addToFields(fields); | 217 List<String> fields = <String>[ |
| 218 _instrumentationServer.log(_join(fields)); | 218 TAG_PLUGIN_ERROR, |
| 219 code, |
| 220 message, |
| 221 stackTrace |
| 222 ]; |
| 223 plugin.addToFields(fields); |
| 224 _instrumentationServer.log(_join(fields)); |
| 225 } |
| 219 } | 226 } |
| 220 | 227 |
| 221 /** | 228 /** |
| 222 * Log that the given non-priority [exception] was thrown, with the given | 229 * Log that the given non-priority [exception] was thrown, with the given |
| 223 * [stackTrace] by the given [plugin]. | 230 * [stackTrace] by the given [plugin]. |
| 224 */ | 231 */ |
| 225 void logPluginException( | 232 void logPluginException( |
| 226 PluginData plugin, dynamic exception, StackTrace stackTrace) { | 233 PluginData plugin, dynamic exception, StackTrace stackTrace) { |
| 227 if (_instrumentationServer != null) { | 234 if (_instrumentationServer != null) { |
| 228 List<String> fields = <String>[ | 235 List<String> fields = <String>[ |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 /** | 508 /** |
| 502 * Add the information about the plugin to the list of [fields] to be sent to | 509 * Add the information about the plugin to the list of [fields] to be sent to |
| 503 * the instrumentation server. | 510 * the instrumentation server. |
| 504 */ | 511 */ |
| 505 void addToFields(List<String> fields) { | 512 void addToFields(List<String> fields) { |
| 506 fields.add(pluginId); | 513 fields.add(pluginId); |
| 507 fields.add(name ?? ''); | 514 fields.add(name ?? ''); |
| 508 fields.add(version ?? ''); | 515 fields.add(version ?? ''); |
| 509 } | 516 } |
| 510 } | 517 } |
| OLD | NEW |