Index: sdk/lib/developer/developer.dart |
diff --git a/sdk/lib/developer/developer.dart b/sdk/lib/developer/developer.dart |
index 03c75c1fbb0c39eecdb3717ecdebb4f0bf94c035..04a3b0053516c8682c14e301ba517965451e970c 100644 |
--- a/sdk/lib/developer/developer.dart |
+++ b/sdk/lib/developer/developer.dart |
@@ -11,16 +11,17 @@ |
/// |
library dart.developer; |
+import 'dart:async'; |
import 'dart:convert'; |
part 'profiler.dart'; |
/// If [when] is true, stop the program as if a breakpoint were hit at the |
/// following statement. |
-/// |
+/// |
/// Returns the value of [when]. Some debuggers may |
/// display [msg]. |
-/// |
+/// |
/// NOTE: When invoked, the isolate will not return until a debugger |
/// continues execution. When running in the Dart VM the behaviour is the same |
/// regardless of whether or not a debugger is connected. When compiled to |
@@ -29,6 +30,36 @@ part 'profiler.dart'; |
external bool debugger({bool when: true, String msg}); |
/// Send a reference to [object] to any attached debuggers. |
-/// |
+/// |
/// Debuggers may open an inspector on the object. Returns the argument. |
external inspect(object); |
+ |
+/// Emit a log event. |
+/// [sequenceNumber] is a monotonically increasing sequence number. |
+/// [millisececondsSinceEpoch] is a timestamp. |
+/// [level] is the severity level (value between 0 and 2000 inclusive). |
+/// [name] is the name of the source of the log message. |
+/// [message] is the log message. |
+/// [zone] (optional) the zone where the log was emitted |
+/// [error] (optional) an error object associated with this log event. |
+/// [stackTrace] (optional) a stack trace associated with this log event. |
+external log(int sequenceNumber, |
+ int millisecondsSinceEpoch, |
+ int level, |
+ String name, |
+ String message, |
+ [Zone zone, |
+ Object error, |
+ StackTrace stackTrace]); |
+ |
+/// Emit a log event for a a [LogRecord] from the [logging] package. |
+void logOnRecord(dynamic logRecord) { |
+ log(logRecord.sequenceNumber, |
+ logRecord.time.millisecondsSinceEpoch, |
+ logRecord.level.value, |
+ logRecord.loggerName, |
+ logRecord.message, |
+ null, |
+ logRecord.error, |
+ logRecord.stackTrace); |
+} |