[dartdevc] implement dart:developer via console logging
dart:developer now logs commands using `console.debug`, so the data is available for use by the debugger. Change-Id: Ib3f3cfa7b099e44ea3c302cd4a91610b188169e2 Reviewed-on: https://dart-review.googlesource.com/c/87942 Reviewed-by: Jacob Richman <jacobr@google.com> Commit-Queue: Jacob Richman <jacobr@google.com> Commit-Queue: Jenny Messerly <jmesserly@google.com>
This commit is contained in:
committed by
commit-bot@chromium.org
parent
2f26679409
commit
7bc2f82011
@@ -20,6 +20,9 @@ bool debugger({bool when = true, String message}) {
|
||||
|
||||
@patch
|
||||
Object inspect(Object object) {
|
||||
// Note: this log level does not show up by default in Chrome.
|
||||
// This is used for communication with the debugger service.
|
||||
JS('', 'console.debug("dart.developer.inspect", #)', object);
|
||||
return object;
|
||||
}
|
||||
|
||||
@@ -32,7 +35,17 @@ void log(String message,
|
||||
Zone zone,
|
||||
Object error,
|
||||
StackTrace stackTrace}) {
|
||||
// TODO.
|
||||
Object items =
|
||||
JS('!', '{ message: #, name: #, level: # }', message, name, level);
|
||||
if (time != null) JS('', '#.time = #', items, time);
|
||||
if (sequenceNumber != null) {
|
||||
JS('', '#.sequenceNumber = #', items, sequenceNumber);
|
||||
}
|
||||
if (zone != null) JS('', '#.zone = #', items, zone);
|
||||
if (error != null) JS('', '#.error = #', items, error);
|
||||
if (stackTrace != null) JS('', '#.stackTrace = #', items, stackTrace);
|
||||
|
||||
JS('', 'console.debug("dart.developer.log", #)', items);
|
||||
}
|
||||
|
||||
final _extensions = Map<String, ServiceExtensionHandler>();
|
||||
@@ -45,11 +58,13 @@ ServiceExtensionHandler _lookupExtension(String method) {
|
||||
@patch
|
||||
_registerExtension(String method, ServiceExtensionHandler handler) {
|
||||
_extensions[method] = handler;
|
||||
JS('', 'console.debug("dart.developer.registerExtension", #)', method);
|
||||
}
|
||||
|
||||
@patch
|
||||
void _postEvent(String eventKind, String eventData) {
|
||||
// TODO.
|
||||
JS('', 'console.debug("dart.developer.postEvent", #, #)', eventKind,
|
||||
eventData);
|
||||
}
|
||||
|
||||
@patch
|
||||
|
||||
Reference in New Issue
Block a user