Index: pkg/analyzer/lib/instrumentation/instrumentation.dart |
diff --git a/pkg/analyzer/lib/instrumentation/instrumentation.dart b/pkg/analyzer/lib/instrumentation/instrumentation.dart |
index 49919fc642a0fbe0b7412452ac9b4d80dac42f37..ac01fef8ce1c542bad06286e29914a0e52da1444 100644 |
--- a/pkg/analyzer/lib/instrumentation/instrumentation.dart |
+++ b/pkg/analyzer/lib/instrumentation/instrumentation.dart |
@@ -23,14 +23,14 @@ class AnalysisPerformanceKind { |
*/ |
abstract class InstrumentationServer { |
/** |
- * Return the identifier used to identify the current session. |
+ * A user-friendly description of this instrumentation server. |
*/ |
- String get sessionId; |
+ String get describe; |
/** |
- * A user-friendly description of this instrumentation server. |
+ * Return the identifier used to identify the current session. |
*/ |
- String get describe; |
+ String get sessionId; |
/** |
* Pass the given [message] to the instrumentation server so that it will be |
@@ -75,6 +75,9 @@ class InstrumentationService { |
static const String TAG_LOG_ENTRY = 'Log'; |
static const String TAG_NOTIFICATION = 'Noti'; |
static const String TAG_PERFORMANCE = 'Perf'; |
+ static const String TAG_PLUGIN_NOTIFICATION = 'PluginNoti'; |
+ static const String TAG_PLUGIN_REQUEST = 'PluginReq'; |
+ static const String TAG_PLUGIN_RESPONSE = 'PluginRes'; |
static const String TAG_REQUEST = 'Req'; |
static const String TAG_RESPONSE = 'Res'; |
static const String TAG_SUBPROCESS_START = 'SPStart'; |
@@ -99,6 +102,8 @@ class InstrumentationService { |
*/ |
InstrumentationService(this._instrumentationServer); |
+ InstrumentationServer get instrumentationServer => _instrumentationServer; |
+ |
/** |
* Return `true` if this [InstrumentationService] was initialized with a |
* non-`null` server (and hence instrumentation is active). |
@@ -115,8 +120,6 @@ class InstrumentationService { |
*/ |
String get _timestamp => new DateTime.now().millisecondsSinceEpoch.toString(); |
- InstrumentationServer get instrumentationServer => _instrumentationServer; |
- |
/** |
* Log that the given analysis [task] is being performed in the given |
* [context]. |
@@ -201,6 +204,27 @@ class InstrumentationService { |
} |
} |
+ void logPluginNotification(Uri pluginUri, String notification) { |
+ if (_instrumentationServer != null) { |
+ _instrumentationServer.log( |
+ _join([TAG_PLUGIN_NOTIFICATION, _toString(pluginUri), notification])); |
+ } |
+ } |
+ |
+ void logPluginRequest(Uri pluginUri, String request) { |
+ if (_instrumentationServer != null) { |
+ _instrumentationServer |
+ .log(_join([TAG_PLUGIN_REQUEST, _toString(pluginUri), request])); |
+ } |
+ } |
+ |
+ void logPluginResponse(Uri pluginUri, String response) { |
+ if (_instrumentationServer != null) { |
+ _instrumentationServer |
+ .log(_join([TAG_PLUGIN_RESPONSE, _toString(pluginUri), response])); |
+ } |
+ } |
+ |
/** |
* Log that the given priority [exception] was thrown, with the given |
* [stackTrace]. |
@@ -374,9 +398,6 @@ class MulticastInstrumentationServer implements InstrumentationServer { |
MulticastInstrumentationServer(this._servers); |
@override |
- String get sessionId => _servers[0].sessionId; |
- |
- @override |
String get describe { |
return _servers |
.map((InstrumentationServer server) => server.describe) |
@@ -384,6 +405,9 @@ class MulticastInstrumentationServer implements InstrumentationServer { |
} |
@override |
+ String get sessionId => _servers[0].sessionId; |
+ |
+ @override |
void log(String message) { |
for (InstrumentationServer server in _servers) { |
server.log(message); |