Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 554f9db

Browse files
bkonyicommit-bot@chromium.org
authored andcommitted
[ VM / Service ] Made Logging event and LogRecord public
Change-Id: Ib1c99a1f2483b98bc414edb9ad0b109ce909cecb Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/100661 Commit-Queue: Ben Konyi <[email protected]> Reviewed-by: Ryan Macnak <[email protected]>
1 parent 46ae4c5 commit 554f9db

File tree

7 files changed

+103
-14
lines changed

7 files changed

+103
-14
lines changed

runtime/observatory/lib/src/service/object.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,7 @@ class RawHeapSnapshot {
12251225

12261226
/// State for a running isolate.
12271227
class Isolate extends ServiceObjectOwner implements M.Isolate {
1228-
static const kLoggingStream = '_Logging';
1228+
static const kLoggingStream = 'Logging';
12291229
static const kExtensionStream = 'Extension';
12301230

12311231
VM get vm => owner;
@@ -2104,7 +2104,7 @@ class ServiceEvent extends ServiceObject {
21042104
static const kInspect = 'Inspect';
21052105
static const kDebuggerSettingsUpdate = '_DebuggerSettingsUpdate';
21062106
static const kConnectionClosed = 'ConnectionClosed';
2107-
static const kLogging = '_Logging';
2107+
static const kLogging = 'Logging';
21082108
static const kExtension = 'Extension';
21092109
static const kServiceRegistered = 'ServiceRegistered';
21102110
static const kServiceUnregistered = 'ServiceUnregistered';

runtime/observatory/tests/service/get_version_rpc_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ var tests = <VMTest>[
1212
var result = await vm.invokeRpcNoUpgrade('getVersion', {});
1313
expect(result['type'], equals('Version'));
1414
expect(result['major'], equals(3));
15-
expect(result['minor'], equals(14));
15+
expect(result['minor'], equals(17));
1616
expect(result['_privateMajor'], equals(0));
1717
expect(result['_privateMinor'], equals(0));
1818
},

runtime/vm/service.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ StreamInfo Service::debug_stream("Debug");
117117
StreamInfo Service::gc_stream("GC");
118118
StreamInfo Service::echo_stream("_Echo");
119119
StreamInfo Service::graph_stream("_Graph");
120-
StreamInfo Service::logging_stream("_Logging");
120+
StreamInfo Service::logging_stream("Logging");
121121
StreamInfo Service::extension_stream("Extension");
122122
StreamInfo Service::timeline_stream("Timeline");
123123

runtime/vm/service.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
namespace dart {
1616

1717
#define SERVICE_PROTOCOL_MAJOR_VERSION 3
18-
#define SERVICE_PROTOCOL_MINOR_VERSION 14
18+
#define SERVICE_PROTOCOL_MINOR_VERSION 17
1919

2020
class Array;
2121
class EmbedderServiceHandler;

runtime/vm/service/service.md

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Dart VM Service Protocol 3.16
1+
# Dart VM Service Protocol 3.17
22

33
> Please post feedback to the [observatory-discuss group][discuss-list]
44
5-
This document describes of _version 3.16_ of the Dart VM Service Protocol. This
5+
This document describes of _version 3.17_ of the Dart VM Service Protocol. This
66
protocol is used to communicate with a running Dart Virtual Machine.
77

88
To use the Service Protocol, start the VM with the *--observe* flag.
@@ -75,6 +75,7 @@ The Service Protocol uses [JSON-RPC 2.0][].
7575
- [Isolate](#isolate)
7676
- [Library](#library)
7777
- [LibraryDependency](#librarydependency)
78+
- [LogRecord](#logrecord)
7879
- [MapAssociation](#mapassociation)
7980
- [MemoryUsage](#memoryusage)
8081
- [Message](#message)
@@ -546,7 +547,7 @@ instance members, class members and top-level members.
546547
If _disableBreakpoints_ is provided and set to true, any breakpoints hit as a
547548
result of this evaluation are ignored. Defaults to false if not provided.
548549

549-
If expression is failed to parse and compile, then [rpc error](#rpc-error) 113
550+
If the expression fails to parse and compile, then [rpc error](#rpc-error) 113
550551
"Expression compilation error" is returned.
551552

552553
If an error occurs while evaluating the expression, an [@Error](#error)
@@ -579,7 +580,7 @@ members, parameters and locals.
579580
If _disableBreakpoints_ is provided and set to true, any breakpoints hit as a
580581
result of this evaluation are ignored. Defaults to false if not provided.
581582

582-
If expression is failed to parse and compile, then [rpc error](#rpc-error) 113
583+
If the expression fails to parse and compile, then [rpc error](#rpc-error) 113
583584
"Expression compilation error" is returned.
584585

585586
If an error occurs while evaluating the expression, an [@Error](#error)
@@ -947,6 +948,7 @@ Debug | PauseStart, PauseExit, PauseBreakpoint, PauseInterrupted, PauseException
947948
GC | GC
948949
Extension | Extension
949950
Timeline | TimelineEvents
951+
Logging | Logging
950952

951953
Additionally, some embedders provide the _Stdout_ and _Stderr_
952954
streams. These streams allow the client to subscribe to writes to
@@ -1424,6 +1426,11 @@ class Event extends Response {
14241426
// IsolateReloaded
14251427
// IsolateSpawn
14261428
string status [optional];
1429+
1430+
// LogRecord data.
1431+
//
1432+
// This is provided for the Logging event.
1433+
LogRecord logRecord [optional];
14271434
}
14281435
```
14291436

@@ -1506,6 +1513,9 @@ enum EventKind {
15061513
15071514
// Event from dart:developer.postEvent.
15081515
Extension
1516+
1517+
// Event from dart:developer.log.
1518+
Logging
15091519
}
15101520
```
15111521

@@ -2214,6 +2224,39 @@ class LibraryDependency {
22142224

22152225
A _LibraryDependency_ provides information about an import or export.
22162226

2227+
### LogRecord
2228+
2229+
```
2230+
class LogRecord extends Response {
2231+
// The log message.
2232+
@Instance message;
2233+
2234+
// The timestamp.
2235+
int time;
2236+
2237+
// The severity level (a value between 0 and 2000).
2238+
//
2239+
// See the package:logging `Level` class for an overview of the possible
2240+
// values.
2241+
int level;
2242+
2243+
// A monotonically increasing sequence number.
2244+
int sequenceNumber;
2245+
2246+
// The name of the source of the log message.
2247+
@Instance loggerName;
2248+
2249+
// The zone where the log was emitted.
2250+
@Instance zone;
2251+
2252+
// An error object associated with this log event.
2253+
@Instance error;
2254+
2255+
// A stack trace associated with this log event.
2256+
@Instance stackTrace;
2257+
}
2258+
```
2259+
22172260
### MapAssociation
22182261

22192262
```
@@ -2811,5 +2854,6 @@ version | comments
28112854
3.14 | Flag 'profile_period' can now be set at runtime, allowing for the profiler sample rate to be changed while the program is running.
28122855
3.15 | Added `disableBreakpoints` parameter to `invoke`, `evaluate`, and `evaluateInFrame`.
28132856
3.16 | Add 'getMemoryUsage' RPC and 'MemoryUsage' object.
2857+
3.17 | Add 'Logging' event kind and the LogRecord class.
28142858

28152859
[discuss-list]: https://groups.google.com/a/dartlang.org/forum/#!forum/observatory-discuss

runtime/vm/service/service_dev.md

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Dart VM Service Protocol 3.17-dev
1+
# Dart VM Service Protocol 3.18-dev
22

33
> Please post feedback to the [observatory-discuss group][discuss-list]
44
5-
This document describes of _version 3.17-dev_ of the Dart VM Service Protocol. This
5+
This document describes of _version 3.18-dev_ of the Dart VM Service Protocol. This
66
protocol is used to communicate with a running Dart Virtual Machine.
77

88
To use the Service Protocol, start the VM with the *--observe* flag.
@@ -75,6 +75,7 @@ The Service Protocol uses [JSON-RPC 2.0][].
7575
- [Isolate](#isolate)
7676
- [Library](#library)
7777
- [LibraryDependency](#librarydependency)
78+
- [LogRecord](#logrecord)
7879
- [MapAssociation](#mapassociation)
7980
- [MemoryUsage](#memoryusage)
8081
- [Message](#message)
@@ -546,7 +547,7 @@ instance members, class members and top-level members.
546547
If _disableBreakpoints_ is provided and set to true, any breakpoints hit as a
547548
result of this evaluation are ignored. Defaults to false if not provided.
548549

549-
If expression is failed to parse and compile, then [rpc error](#rpc-error) 113
550+
If the expression fails to parse and compile, then [rpc error](#rpc-error) 113
550551
"Expression compilation error" is returned.
551552

552553
If an error occurs while evaluating the expression, an [@Error](#error)
@@ -579,7 +580,7 @@ members, parameters and locals.
579580
If _disableBreakpoints_ is provided and set to true, any breakpoints hit as a
580581
result of this evaluation are ignored. Defaults to false if not provided.
581582

582-
If expression is failed to parse and compile, then [rpc error](#rpc-error) 113
583+
If the expression fails to parse and compile, then [rpc error](#rpc-error) 113
583584
"Expression compilation error" is returned.
584585

585586
If an error occurs while evaluating the expression, an [@Error](#error)
@@ -947,6 +948,7 @@ Debug | PauseStart, PauseExit, PauseBreakpoint, PauseInterrupted, PauseException
947948
GC | GC
948949
Extension | Extension
949950
Timeline | TimelineEvents
951+
Logging | Logging
950952

951953
Additionally, some embedders provide the _Stdout_ and _Stderr_
952954
streams. These streams allow the client to subscribe to writes to
@@ -1424,6 +1426,11 @@ class Event extends Response {
14241426
// IsolateReloaded
14251427
// IsolateSpawn
14261428
string status [optional];
1429+
1430+
// LogRecord data.
1431+
//
1432+
// This is provided for the Logging event.
1433+
LogRecord logRecord [optional];
14271434
}
14281435
```
14291436

@@ -1506,6 +1513,9 @@ enum EventKind {
15061513
15071514
// Event from dart:developer.postEvent.
15081515
Extension
1516+
1517+
// Event from dart:developer.log.
1518+
Logging
15091519
}
15101520
```
15111521

@@ -2214,6 +2224,39 @@ class LibraryDependency {
22142224

22152225
A _LibraryDependency_ provides information about an import or export.
22162226

2227+
### LogRecord
2228+
2229+
```
2230+
class LogRecord extends Response {
2231+
// The log message.
2232+
@Instance message;
2233+
2234+
// The timestamp.
2235+
int time;
2236+
2237+
// The severity level (a value between 0 and 2000).
2238+
//
2239+
// See the package:logging `Level` class for an overview of the possible
2240+
// values.
2241+
int level;
2242+
2243+
// A monotonically increasing sequence number.
2244+
int sequenceNumber;
2245+
2246+
// The name of the source of the log message.
2247+
@Instance loggerName;
2248+
2249+
// The zone where the log was emitted.
2250+
@Instance zone;
2251+
2252+
// An error object associated with this log event.
2253+
@Instance error;
2254+
2255+
// A stack trace associated with this log event.
2256+
@Instance stackTrace;
2257+
}
2258+
```
2259+
22172260
### MapAssociation
22182261

22192262
```
@@ -2811,5 +2854,6 @@ version | comments
28112854
3.14 | Flag 'profile_period' can now be set at runtime, allowing for the profiler sample rate to be changed while the program is running.
28122855
3.15 | Added `disableBreakpoints` parameter to `invoke`, `evaluate`, and `evaluateInFrame`.
28132856
3.16 | Add 'getMemoryUsage' RPC and 'MemoryUsage' object.
2857+
3.17 | Add 'Logging' event kind and the LogRecord class.
28142858

28152859
[discuss-list]: https://groups.google.com/a/dartlang.org/forum/#!forum/observatory-discuss

runtime/vm/service_event.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const char* ServiceEvent::KindAsCString() const {
9595
case kEmbedder:
9696
return embedder_kind();
9797
case kLogging:
98-
return "_Logging";
98+
return "Logging";
9999
case kDebuggerSettingsUpdate:
100100
return "_DebuggerSettingsUpdate";
101101
case kIllegal:
@@ -239,6 +239,7 @@ void ServiceEvent::PrintJSON(JSONStream* js) const {
239239
}
240240
if (kind() == kLogging) {
241241
JSONObject logRecord(&jsobj, "logRecord");
242+
logRecord.AddProperty("type", "LogRecord");
242243
logRecord.AddProperty64("sequenceNumber", log_record_.sequence_number);
243244
logRecord.AddPropertyTimeMillis("time", log_record_.timestamp);
244245
logRecord.AddProperty64("level", log_record_.level);

0 commit comments

Comments
 (0)