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

Unified Diff: runtime/observatory/lib/src/service/object.dart

Issue 1241683005: Support piping log data over the service protocol (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: runtime/observatory/lib/src/service/object.dart
diff --git a/runtime/observatory/lib/src/service/object.dart b/runtime/observatory/lib/src/service/object.dart
index fa73cf6266a6b429e6185147b7eab837fa8af9ef..4ad633d1bcd2d99d4660b365a0399f6aedf727d1 100644
--- a/runtime/observatory/lib/src/service/object.dart
+++ b/runtime/observatory/lib/src/service/object.dart
@@ -700,6 +700,7 @@ abstract class VM extends ServiceObjectOwner {
static const kStdoutStream = 'Stdout';
static const kStderrStream = 'Stderr';
static const _kGraphStream = '_Graph';
+ static const kLoggingStream = '_Logging';
/// Returns a single-subscription Stream object for a VM event stream.
Future<Stream> getEventStream(String streamId) async {
@@ -1591,6 +1592,15 @@ class DartError extends ServiceObject {
String toString() => 'DartError($message)';
}
+Level _findLogLevel(int value) {
+ for (var level in Level.LEVELS) {
+ if (level.value == value) {
+ return level;
+ }
+ }
+ return new Level('$value', value);
+}
+
/// A [ServiceEvent] is an asynchronous event notification from the vm.
class ServiceEvent extends ServiceObject {
/// The possible 'kind' values.
@@ -1611,6 +1621,7 @@ class ServiceEvent extends ServiceObject {
static const kInspect = 'Inspect';
static const kDebuggerSettingsUpdate = '_DebuggerSettingsUpdate';
static const kConnectionClosed = 'ConnectionClosed';
+ static const kLogging = '_Logging';
ServiceEvent._empty(ServiceObjectOwner owner) : super._empty(owner);
@@ -1629,6 +1640,7 @@ class ServiceEvent extends ServiceObject {
@observable String reason;
@observable String exceptions;
@observable String bytesAsString;
+ @observable Map logRecord;
int chunkIndex, chunkCount, nodeCount;
@observable bool get isPauseEvent {
@@ -1691,6 +1703,12 @@ class ServiceEvent extends ServiceObject {
var bytes = decodeBase64(map['bytes']);
bytesAsString = UTF8.decode(bytes);
}
+ if (map['logRecord'] != null) {
+ logRecord = map['logRecord'];
+ logRecord['time'] =
+ new DateTime.fromMillisecondsSinceEpoch(logRecord['time']);
+ logRecord['level'] = _findLogLevel(logRecord['level']);
+ }
}
String toString() {

Powered by Google App Engine
This is Rietveld 408576698